Is .Net 6 also called .NetFramework version 6? and is it not compatible with .netcoreapp2.0? - c#

We are trying to upgrade our .Net core 2.1 app to use .Net 6. I used tried to use the upgrade assistant here, https://dotnet.microsoft.com/en-us/platform/upgrade-assistant/tutorial/install-upgrade-assistant
We now get many errors but the one that is confusing me is the naming, Is .NetFramework,Version 6.0 the same a .Net 6? I thought framework was old stuff?
Also as you can see from the error example below, it seems that our current nuget packages are not compatible with the new code, if I have read that right. Should we have set the nuget packages to be .Net Standard 2.1 to get around this?

Ok so I should not have tried to use the upgrade assistant, that seems to be for framework relates code. Instead following steps here https://learn.microsoft.com/en-us/aspnet/core/migration/21-to-22?view=aspnetcore-5.0&tabs=visual-studio for each version. Not ideal as would like an easier solution, but at least it gives some guidelines.

Related

Package 'Microsoft.AspNet.TelemetryCorrelation 1.0.8' was restored

Any idea how to solve this.
I tried updating nuget packages. But it did not solve the problem.
TargetFramework is net6.0.
Error is very clear from the error message.
This package doesn't support .Net 6.
It supports only the .net framework, not the .net core. So you should not use it in .Net 6 target framework apps.
Microsoft.ApplicationInsights.Web also doesn't support .Net 6.

Migrate from .net standard to .net 6 using the upgrade tool

I tried upgrading a .NET standard project to a .NET 6 project using this upgrade assistant tool:
https://dotnet.microsoft.com/en-us/platform/upgrade-assistant/tutorial/install-upgrade-assistant
I ran the tool as the steps describe (installing it, using upgrade-assistant analyze with the project csproj path and then upgrade-assistant upgrade with the path), but after it was done, the project still remains with a target framework of .net standard 2.0.
Is there something else needs to be done in order to upgrade the framework?
I eventually simply edited the project file directly. To convert it to .net 6 all you need to do is change the <TargetFramework> to be like this:
<TargetFramework>net6.0</TargetFramework>
It's a 3 seconds work so no need for any tools
.NET standard works parallelly. That means you would have to update to .NET standard 2.1 if you need it for other old framework projects. Otherwise create new libraries in .NET 6 and migrate your code.
According to microsoft:
https://dotnet.microsoft.com/en-us/platform/dotnet-standard,
.NET 6 supports .NET Standard 2.1.
Future versions of .NET will also support .NET Standard 2.1 and earlier versions.
The interface Project > Property tools isn't the way to update version from .Net standard to other versions other than standard versions. The right/easiest way is updating the TargetFramework in .csproj file of the project directly.

Converting a project from .NET5 to .NET Framework 4.8

Long story, summarized...
I started working on a solution creating many projects (like class libraries) for the solution. Then I ended up needing to use a third-party SDK for something I had an expensive license for. Come to find out, that third-party SDK only supported .NET Framework.
Because my solution was based in .NET 5/Core and the SDK in .NET Framework I had a big issue. They can not exist in the same environment and reference each other. So, on to biting the bullet and spending hours converting all my projects to .NET Framework 4.8 while singing a neverending song of curse words...
The Issue
My first class library I'm trying to convert from .NET5 to .NET 4.8 happens to have a Nuget package installed. That Nuget is Newtonsoft.Json Version="12.0.3" (https://www.nuget.org/packages/Newtonsoft.Json).
After changing the framework in the project file, VSCode is telling me the Newtonsoft namespace can not be found. This makes me think that the Nuget I have installed is not compatible with .NET Framework 4.8.
The issue I was running into was the namespace Newtonsoft could not be found after changing the framework from net5.0 to net48.
The issue was OmniSharp that was giving a false positive. I restarted VSCode and the issue went away once VSCode loaded with the new framework being used.
.NET supports cross platform targeting which means you can have your SDK style .NET5 project multi-targets both net5 and net48. In future, if the third-party library targets .NET Core then you can simply change the TargetFrameworks property.
A similar issue has been discussed here https://github.com/dotnet/runtime/discussions/40304 incase if that helps.

How to migrate from .NET Framework 4.6 to .NET Core 3.1

I created a new project in VS 2019 in .NET Framework 4.6 and now I want to upgrade it to .NET Core 3.1.
I do not want to do manually because their is ton of code.
How can I do this?
Microsoft published a guide for porting .NET Framework applications to .NET Core:
https://learn.microsoft.com/en-us/dotnet/core/porting/
In a nutshell, it boils down to the following:
Manually convert your dependency and project files.
Ensure that all your dependencies are compatible with .NET Core.
Use the .NET Portability Analyzer to find out if you are using features which are not supported in .NET Core.
Use the .NET API analyzer to find out if you are using features which are not supported on some platforms.
Target .NET Core, fix compile errors and test.
The guide contains detailed descriptions for specific steps (e.g., how to port your WinForms/WPF UI code), which are too long to paraphrase in an SO answer, so be sure to read it carefully.
I do not want to do manually because their is ton of code.
Then you'll have to pay a developer to do that for you. Sorry, but at the time of writing, there is no fully automated .NET Framework -> .NET Core converter available.

How to Upgrade to ASP.NET Core 2.0

I have an ASP.NET Core project. It is .NET Framework based. I have been working with .NET Version 4.6, but am happy to upgrade to 4.6.2 or 4.7. I have both installed on my machine. The referenced NuGet packages are numerous and version numbers varied. But, it seems that roughly speaking, I am using version 1.1.3 of ASP.NET Core.
I want to upgrade to the latest version of ASP.NET Core and ASP.NET Core MVC but every time I try, I get this error message:
Could not install package 'Microsoft.AspNetCore.Mvc.Core 2.0.0'. You
are trying to install this package into a project that targets
'.NETFramework,Version=v4.7', but the package does not contain any
assembly references or content files that are compatible with that
framework. For more information, contact the package author.
After Googling for this, I came across this disconcerting Github thread:
https://github.com/aspnet/home/issues/2022
This seems to imply that at some point, V2 was not supported by the .NET Framework. I read through the thread to some extent, but these words from another user basically some up my thoughts on the subject:
I really don't know what is happening. Why do have many dotnet this
and that. This is really crazy. How do we have keep tracks of this?
No proper documentation on migration from one to another.
The OP was edited to say this:
Edit: the "no .NET Framework support for ASP.NET Core 2.0" plan has
been officially cancelled and running ASP.NET Core 2.0 on .NET Desktop
will be supported in the next previews. For more information, read
Announcing ASP.NET Core 2.0.0-Preview1 and Updates for .NET Web
Developers or watch .NET Standard 2.0 and .NET Core 2.0.
I guess that means that Microsoft planned to fix the problem at some point. But, what I can't work out is whether or not Microsoft have actually fixed this problem.
Is anyone running ASP.NET Core on .NET Framework? Which .NET version? How did you get it working?
As per #Melbourne Developer's suggestion:
Make sure you download the latest .Net Core 2.0 installers.
Create new ASP.Net Core Web Application
Choose .NET Framework from dropdownlist in wizard and ASP.Net Core 2.0
Copy content over to new project. Fixing up all namespace issues/compilation errors

Categories

Resources