How can I use VS2019 Files in VS2022 and vice versa? - vb.net

In my school they use VS 2019. I installed the same because that was what was available at the time (community version for me, I think the same for my school).
I had a couple of issues with VS2019 so I uninstalled everything and installed 2022 version instead. I then began to use this for the last 2 weeks but when I tried to open my old files, I couldn't.
I did install framework 3.1 again and the code will enter runtime successfully, but I still can't see the code that I wrote. I don't want to re-install VS2019 because it kept on giving me issues with intellisense which I just couldn't fix.
Is there any way I will be able to open my old 2019 files in 2022? Also, will 2019 be able to open 2022 files?

The generic answer to this is mostly yes but maybe no depending on your specifics. That's not a helpful sentence, so let me explain.
For the most part, Visual Studio solutions and projects are cross-compatible1. This means that if you have a project from one version, you can usually open it in another version without issue. The major caveat to this is the range of frameworks supported by each VS version may be different. VS will often be able to open the project, but might not be able to build and run it.
(Because you tagged this with vb.net, I'm limiting this to .NET versions. The same concepts may apply for other platforms.)
For example, VS2019 supports:
.NET version 5 (Visual Studio 16.8 or later)
.NET Framework versions 4.8, 4.7.2, 4.7.1, 4.7, 4.6.2, 4.6.1, 4.6, 4.5.2, 4.5.1, 4.5, and 4.0
.NET Core 3.1, 3.0, 2.2, 2.1, and 1.1.
And VS2022 supports:
.NET Framework versions 4.8, 4.7.2, 4.7.1, 4.7, and 4.6.2
.NET Core 6.0 Preview, 5.0, 3.1, 3.0, 2.2, and 2.1.
Note how VS2022:
DOES NOT support .NET Framework versions 4.0-4.6.1, or .NET Core 1.1
DOES support .NET (Core) 6.0 - which VS2019 does not
It is reasonable to expect that the next version of VS will stop supporting some versions while it adds support for new ones again, so this compatibility range will change with each VS release.
1: Each different type of project requires a Project System to support it. Occasionally, these may be dropped out of support like with the frameworks described above, but with the more severe consequence that VS will not be able to open the project at all. Some examples over time: Silverlight and Windows Phone projects, Setup projects, DNX (early .NET Core) projects, etc.

Related

ASP.NET Core 3.0 not showing on Visual Studio 2019

I want to test the new Blazor server-side framework (aka Razor Components).
I installed Visual Studio 2019 RC, and then the .Net Core 3.0 preview 2, following this official tutorial.
After the install, I only see the ASP.NET Core 2.0 and the 2.1 on the "Create a new ASP.NET Core Web Application" page. The 3.0 is not showing up.
I started to mess around, trying to install other packages from this page, uninstalled and reinstalled Visual Studio 2019, updated to the .NET Core Preview 3, installed several times the x64 and x86 packages in different orders, copy/paste the .Net Core binaries to random folders and so on. Nothing works. The ASP.NET Core 3.0 does not show up.
Here is what my VS looks like when creating a project (the yellow message appeared latter after some messing around with the packages, so it is not the real problem):
Here is the output of the dotnet --list-sdks command:
EDIT
For some reason, I installed the Blazor VSIX package (the WebAssembly - not exactly what I want, but I installed it anyways) and now the ASP.NET Core 3.0 simply shows up. However, just for the blazor templates:
I don't understand. Is there anything obvious I'm missing?
There is an option in Tools -> Options that enables preview versions of the .NET Core SDK. In the VS Preview shipping channel, it is on (by default, and not settable). In the VS Release channel, it defaults to off and you can opt-in.
(Note: it's disabled in the screenshot because I have a Preview build installed.)
The reason for this is to allow you to customize whether a project using a released version of .NET Core (such as 2.1, the current LTS) will use tooling from the newer not-yet-release-quality SDK.
Prior to 16.1, this option was located on the Tools -> Options -> Projects and Solutions -> .NET Core page.
Here is what I did to show .NET Core 3.0 in VS2019
Installed .NET Core 3.0 SDK (No Success)
Restarted VS2019 after installing .NET Core 3.0 SDK (No Success)
Updated VS2019 (Worked Perfectly)
I had the same issue. Here is what worked for me.
First, download the latest .Net Core 3.0 SDK (see 1,2 below).
Next, Check for updates (4,5). (this is what helped me the most)
Next, Enable Preview SDK (5,6,7,8,9) and restart
Now, the .net core 3.0 option should show (11).
It no longer works... again!
The SDK 3.0.100-preview8-013656 doesn't provide the ASP.Net Core 3.0 project template.
You have to uninstall it and install SDK 3.0.100-preview7-012821
https://dotnet.microsoft.com/download/dotnet-core/3.0
I have the same issue here after moving from Visual Studio 2019 Preview to Visual Studio 2019 RC.
This page seems to suggest that you need Preview to use .net Core 3.0 which is annoying.
https://dotnet.microsoft.com/download/dotnet-core/3.0
I looked up the difference between RC and Preview, and they pull builds from different channels (stable and preview).
The next thing I’m going to try is to go back to Preview to see if .Net Core 3.0 becomes visible again.
Tried to get .NET Core 3 (preview 8 in my case) to work in the release version of Visual Studio 2019 but ASP.NET Core 3.0 refused to show up in the "Create new ASP.NET Core web application" dialog.
What eventually worked was to install the Preview version of Visual Studio 2019.
I could have saved a few hours and a lot of hair if I had taken the warning text ".NET Core 3.0 should be used with the latest previews of Visual Studio." (https://dotnet.microsoft.com/download/dotnet-core/3.0) more literally...
In my case is because I did not installed Visual Studio 2019 with that feature. So just create a new project and type .net core. Then click on Install more tools and features:
Then add the following feature:
I had this problem and solved it as follows:
STEP 1: Download .NET Core 3.0
STEP2: Enable the ability to consume preview SDKs by default, As shown below:
I had the very same issue. I tried everything with no success
I already had only x64 version of .NET Core SDK
In addition i had to install x86 version too. That WORKED !!!
If your solution uses global.json and sdk:version isn't compatible with the target framework, it won't let you select it or it disappears from Target framework drop-down in your project's properties. You will need to update it to something like this:
{
"sdk": {
"version": "3.1.0",
"rollForward": "latestMinor"
}
}
I resolved it by installing
dotnet-sdk-3.1.403-win-x86.exe
dotnet-sdk-3.1.403-win-x64.exe
Because the visual studio was taking the SDK from "C:\Program Files (x86)\dotnet\sdk" once you install "dotnet-sdk-3.1.403-win-x86.exe" there will one folder under the above directory. then no need to restart your PC.
https://dotnet.microsoft.com/download/visual-studio-sdks?utm_source=getdotnetsdk&utm_medium=referral
ASP.Net Core 3.0+ just runs on vs2019 version 16.7+.
You need to go to help tab on your visual studio and check for updates and update it to the latest version
Note! (don't use it on your developer machine)
0- make sure you installed .net core 3 sdk. dotnet --list-sdks
1- make sure Tools -> Options that enables preview versions of the .NET Core SDK enabled.
2- uninstall all x86 version of .net core sdk from your machine.
3- restart visual studio and try to create a new project.
I was not able to get .netcore 3.0 preview8 working on my Visual Studio Community Edition (version 16.2.3). I opted to uninstall .netcore 3.0 preview8 and I installed .netcore 3.0 preview7 instead. After insalling .netcore 3.0 preview7 In Visual Studio I checked use previews of the .NET Core SDK option that is in Tools -> Options -> Preview Features and I restarted it. That worked for me, but if someone have .netcore 3.0 preview8 already working, help will be appreciated it.
I've encountered the same problem on a Mac and found a solution to this issue.
On visual studio update tab (Visual Studio -> check for updates) there is a option to change channel to "Preview".
After that you can download necessary updates and go using .net core 3.0
I noticed an interesting behavior. I had the latest version of VS with all the dependencies installed. But when I try to add a new project to the solution, the dialog does not show me the options beyond .Net Core 2.2
But When I create the new project from the startup page, the drop down does show the ASP.NET Core 3.1
So I was able to work around the issue by creating the new project from the startup page, then add the existing project to the solution.
I've had the same issue after installing .net core 3.1. This is how I resolved it.
open powershell, type dotnet --version, it returns '2.2.300'
go to 'programs and features', unistall .net core sdk 2.2.3.0
run dotnet --version again, it returns '3.1.302' and in VS 2019 it shows '.net 3.1'
This answer is for the newest .NET Core version as of 10/11/2020, which is .NET Core 5.0
Specs: VS Version 16.8.0
Target Version of .Net Core: 5.0
You must have version 16.8.0 in order to have .Net Core 5.0
If you still have problems with Visual Studio not showing .Net Core 5.0 in Visual Studio version 16.8.0 (and assuming you downloaded the .NET Core 5.0 SDK for Visual Studio), well, apparently (and correct me if I'm wrong) it is now called just .Net 5.0, omitting the Core.
After selecting .NET 5.0, I was able to install other libraries which are currently version 5.0+ and dependent on .NET Core 5.0+
Is the new name intentional? Anyways, here some evidence of this working (I was able to install the newest version of Newtonsoft and Entity Framework for .Net Core):
Funny enough, when I try to create a new .Net Core project, the version shows up as expected:
I'm very sorry for my English!
[PS: I'm literally copying&pasting this answer, which I answered somewhere else, but given that, when you Google this issue, this stackoverflow question appears first. So thats why I'm reposting]

Azure Function Targeting .NET Standard Showing Warning

Just installed Visual Studio 15.5 Preview so that I can create an Azure Function targeting .NET Core. Without making any changes, I'm seeing a warning -- see below -- that reads:
Package Microsoft.AspNet.WebApi.Client 5.2.2 was restored using .NET
Framework version 4.6.1 instead of the project target framework .NET
Standard version 2.0. This package may not be fully compatible with
your project.
Any idea how to fix this or do I ignore this warning? As I said, this is a brand new Azure Function project I created with no changes at all.
Here's what the warning looks like:
You can pretty much ignore it, in this case.
Microsoft.AspNet.WebApi.Client targets "Portable Class Library (.NETFramework 4.5, Windows 0.0, WindowsPhone 8.0, WindowsPhone 8.1, WindowsPhoneApp 8.1)" (or net45+win8+win81 as it's the target framework moniker called), which means it's fully compatible with .NET Core and .NET Standard (>= 1.2).
The warning comes, because it do not target the netstandard1.x or netstandard2.x moniker specifically. It just tell you "this might not be compatible on .NET Core/.NET Standard".
Yes, you did nothing wrong: this is to be expected for now. Functions v2 are in beta now, so you'd have to live with this warning for a while. It should give you no functional issues.

When updating to .NET Core 1.0 RC2 should "/Program Files/DNX/" be deleted?

These instructions https://www.microsoft.com/net/core#windows indicate that all previous version of .NET Core should be removed from Windows via the Add/Remove Programs before installing .NET Core SDK 1.0 RC2 on Windows.
However after running the uninstall from Add/Remove Programs in Windows 7 and installing .NET Core SDK I see that my /Program Files/DNX/ folder still exits.
This makes me wonder if I should delete it to clean up the system. But perhaps it's needed when working with older projects that were created with RC1 under DNX.
I'd like to know if it's ok to delete the dnx folder and it associated runtimes?
It's up to you. If you leave them there nothing bad will happen because the executables have different names (dnx/dotnet).
You can have dnx and dotnet side by side.
You should not delete this folders if you have old (DNX-based) projects that you still want to run. Otherwise, you will need to reinstall the dnx runtimes again to work with your old (RC1) apps.
Your new (RC2, dotnet cli) projects will known nothing about this old dnx-based folder and will ignore it completely.
Microsoft advise you to remove any old version of .Net Core. The DNX was the runtime and toolset used to build .Net Core and .Net Core apps as per Microsoft. It was consisted of DNVM, DNX and DNU.
With the .Net Core CLI all above (DNVM, DNX and DNU) are part of a single toolset.
You'll may find some issues when removing DNX, also when migrating a existing solution on any beta/rc version of clr or coreclr which were (dnxcore50 or dnx46) and others deprecated now.
NOTE: when uninstalling MS ASP.NET 5 RC1 Update 1 (old version), you
may have issues on your VS 2015 regarding to some projects templates,
existing MVC or WebAPI projects may not load.
I'd suggest you to migrate to .Net Core 1.0 as I did in my side, it was a little pain but you won't go anywhere with a project target to a deprecated version.
You can follow these links to migrate your app:
1) https://chsakell.com/2016/05/21/migrating-asp-net-5-rc1-apps-to-asp-net-core/
2) http://dotnet.github.io/docs/core-concepts/dnx-migration.html

'Forms' is not a member of 'Windows'

I tried to change the Target Framework on my app recently from .NET Framework 4.5 to 4.5.2, but if I do I get the following error when trying to build: "'Forms' is not a member of 'Windows'" (that is, System.Windows.Forms). Changing to 4.5.1 works normally. I'm using Visual Studio 2013 Ultimate.
I had this error when changing to 4.5.2.
In my case the error was related to a MessageBox ... I replaced: "Windows.Forms.DialogResult.Yes" (which caused the same error message) with "System.Windows.Forms.DialogResult.Yes" which did the trick.
I had the same problem, me too with Windows.Forms.DialogResult enumeration values.
The project automatically imports System and System.Windows.Forms namespaces and worked fine up to 4.5.1.
In 4.5.2 I had to remove Windows.Forms. and just leave DialogResult.Ok (or whatever else) in my code, it seems to be a problem with namespaces resolution.
Make sure that you add System in front of the Windows.Form.
I ran into this with an application still targeted to .NET 4.0, where it failed on one (new) build server, but ran on my older ones.
I narrowed it down to the .NET 4.0 Targeting Pack only being installed on the old build servers. Targeting pack is included in Visual Studio, or the Windows 7.1 SDK. It is for some reason not distributed separately, and with support ending for .NET 4, 4.5 and 4.5.1, I don't suspect this is likely to change. Because my older servers have been around a couple years, they've gone through in-place upgrades and so had the targeting pack already.
When you install Windows 7.1 SDK on Server 2012R2, it complains something to the effect of "A pre-release version of .NET 4 is installed, please install the RTM version". As far as I can tell, it's simply because a newer version) is installed -- Server 2012R2 comes with 4.5.1. I tried to uninstall all newer versions, but was unable to get the SDK to install the targeting pack.
So to install:
Download the Windows 7.1 SDK ISO image
Unzip it
Run Setup\MTPack\netfx_dtp.msi EXTUI=1
You should now have a %programfiles(x86)%\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\ folder with the 4.0 stuff.
(EXTUI=1 bypasses the restriction that it can't be installed separately).
This allowed me to compile projects still targeting 4.0 (or re-build old revisions/branches that were targeting it at the time).

What is the difference in HttpClient in .net 4.0 and .net 4.5

I am working on a project that is currently using an early pre-release .net 4.0 version on HttpClient in System.Web.Http namespace. We know that this version causes conflicts with .net 4.5 version.
We are thinking of upgrading to Visual Studio 2012 and we know that this is going to install .net 4.5 (which we dont currently use). My question(s) is, how drastically different are the two version of the HttpClient class? Or, would the use of the latest .net 4.0 version of HttpClient be enough to get us to a stage where we could install .net 4.5 and not have any conflicts?
Cheers
NCBL
The two versions are identical from an API perspective and 4.5 is backwards compatible with 4.0 from a functionality perspective. The 4.5 version does support a couple new features on WebRequestHandler (ContinueTimeout & ServerCertificateValidationCallback) so avoid those.
You shouldn't run into any conflicts when using this library and running on 4.5. The 4.5 version has the same name as the 4.0 version and the framework will unify to the inbox version.