.NET Core Upgrading - .net-core

I have a API that is actively being developed, running on .net core 2.1. Is the idea with .NET Core to constantly be updating my project/code to the latest version of .NET Core?
Now I see that 2.2 is stable. Should I target that, and then when 3.0 is here change to target that?

It's partly a matter of preference and necessity.
If you prefer to stay current and there are no breaking changes, an upgrade is advisable because you have access to new APIs, features, and performance improvements.
If upgrading would break your code due to a breaking change in an API or behavior, or upgrading adds significant maintenance issues to your project, then don't upgrade (at least until you adapt/change your code to deal with the breaking change).

Related

.NET6 vs .NET Core 3.1 compatibility

Is it safe to have a .NET6 application which references a .NET Core 3.1 NuGet library?
I tested this case using a simple console application. Everything looks good and there are no errors/warning. However, I haven't found any specific information so prefer to make sure.
This is important, as one of my providers offers only a .NET Core 3.1 NuGet package. Knowing the company it'll take them a year or so to prepare a .NET6 / .NETStandard version.
There is a good chance that your .NET Core 3.1 library will run without any compatibility problems as part of your .NET 6 application.
Quoting the .NET fundamentals article Changes that affect compatibility (emphasis mine):
Throughout its history, .NET has attempted to maintain a high level of
compatibility from version to version and across implementations of
.NET. …
Along with compatibility across .NET implementations, developers
expect a high level of compatibility across versions of a given
implementation of .NET. In particular, code written for an earlier
version of .NET Core should run seamlessly on .NET 5 or a later
version. In fact, many developers expect that the new APIs found in
newly released versions of .NET should also be compatible with the
pre-release versions in which those APIs were introduced.
However, compatibility is not guaranteed. The article goes on to say:
This article outlines changes that affect compatibility and the
way in which the .NET team evaluates each type of change.
Understanding how the .NET team approaches possible breaking
changes is particularly helpful for developers who open pull
requests that modify the behavior of existing .NET APIs.
Furthermore, in an answer to the question Clarification on backwards compatibility of .NET Core, a member of the .NET runtime team says:
We do not guarantee 100% compatibility between major versions. This is true for both ASP.NET Core and the runtime itself. We
intentionally make breaking changes where we believe that they are
necessary to move the platform forward and the cost of the .NET
ecosystem adjusting to them is low enough.
Breaking changes that could potentially affect the compatibility of your .NET Core 3.1 library are those that are documented for .NET 5 and .NET 6.
But, if you are not experiencing any problems with your .NET Core 3.1 library, it would appear that none of the documented compatibility problems apply.
Ultimately, of course, you'll have a higher degree of confidence in the library when your vendor provides one that has been updated for .NET 6.
Finally, with the introduction of .NET 5, there became a lesser need for .NET Standard:
.NET Standard is a formal specification of .NET APIs that are
available on multiple .NET implementations. The motivation behind .NET
Standard was to establish greater uniformity in the .NET ecosystem.
.NET 5 and later versions adopt a different approach to establishing uniformity that eliminates the need for .NET Standard in most
scenarios. However, if you want to share code between .NET Framework
and any other .NET implementation, such as .NET Core, your library
should target .NET Standard 2.0. No new versions of .NET Standard will
be released, but .NET 5, .NET 6, and all future versions will continue
to support .NET Standard 2.1 and earlier.

Can I update to .Net 5 NuGet packages even if I'm using .Net Core 3.1?

I was looking for some NuGet updates about my project libraries. I see that there are a lot of Microsoft libraries update to v5.0.0.
Based on my knowledge I think these are new dependencies released with .Net 5.0 and I'm not sure that I can update these libraries to latest version using .Net Core 3.1 project.
Can I update to v5.0.0 libraries even if I'm using/building a .Net Core 3.1 project?
Unfortunately, you cannot update many of these newest Nuget packages to 5.0. The reason being is that the newest Nuget package versions are written primarily for .NET 5, and often times Nuget Package Manager will even prevent you from installing them since there are differences in the APIs. With that said, there may be a few spots where it will allow the installation, but I wouldn't recommend it if you plan to keep the application on .NET Core 3.1. Most likely it could cause some inconsistencies that would be hard to debug. Proceed with caution, or upgrade your projects to .NET 5.
I just finished the same. I had 3.1 core application with a lot of 3.1 and NET Standard2.0 libraries projects and just updated all these libraries to the version 5. All libraries were working ok, I could compile them. But I couldn't compile my main Web application. It started to give some strange errors that some staff needs .net5. Maybe it could be fixed but I didn't see much sense to waste my time since in any case I was planning to move to net5 in a couple of days. So I just decided to move to net5 immediately. I had installed net 5.0 SDK and change target framework of my application to net5.0. Now everything is working fine and I am happy with my net5.0 application. I have some Net 4.8 projects that use the same common libraries that I am using for Net Core. So these common libraries are targeted to netstandard2.0. and can't change them to Net5. Now all these Standard2.0 projects still work with my net5.0 web application without any problem. Since I didn't have any problems with my previous version 3.1.9 I DON'T RECOMEND to update libraries to 5.0 if YOU DON'T PLAN to move your application to Net5.0. You can get more problems after this then you can gain from this update.
You should report such (VS for Mac and VS for Windows) as product defects to Microsoft, as many of the new 5.0 packages are targeting net5 solely, and not applicable to netcoreapp3.1.
Try to use outdated tool to check package updates, which is much more reliable,
https://github.com/dotnet-outdated/dotnet-outdated

Microsoft.xrm.Sdk referenced in .Net core and .Net standards

My project is completely designed with. NetCore 2.2 and. Netstandards2.0. I need to refer
Microsoft.Xrm.SDK. But Microsoft.Xrm.SDK supported by full framework. I have tried to. NetCore 3.1 also no luck. I have gone through many articles, every one saying now only they start releasing the alpha version. There is only a roadmap so far.
As you already found, the .NET Core version is in Alpha release.
This is an update article to the right packages to use:
https://colinvermander.com/2020/02/13/net-core-cds-sdk-alpha-availability/
Regarding your project, you can eventually include all the calls to Dynamics 365 to a separate project/assembly so the rest of the project can be compatible with .NET Core and only that specific project/assembly to the full .NET

.NET Core v1 release compatible with ASP.NET CORE RC1?

I am new to this ASP.NET versions and I built an app on ASP.NET CORE RC1, MVC6, EF7 & ANGULARJS. I was told that I would need to update the app to use v1 release of .NET Core instead of a release candidate.
I don't know much but that the change was significant with RC1 to RC2, but what do I have to do to update the app for it to work for the .NET Core v1 release?
The changes from RC1 to the recent RTM release are fairly substantial and contain lots of breaking changes (i.e. different API calls, differently named namespaces/packages, etc.) and there isn't really any type of automatic migration process.
Regarding Migrating Your Application
If you want to attempt to migrate your application to the recent release, you should consider checking out Shawn Wildermuth's blog posts on the process :
Migrating from ASP.NET Core RC1 to RC2
Migrating from ASP.NET Core RC2 to RTM
He goes into quite a bit of detail on all of the changes that you need to make that should get your application where it needs to be.
The other option would be to spin up a new ASP.NET Core application and manually migrate some of your existing code into it. This may not necessarily be feasible depending on the size of your project, but for smaller projects it'll likely be an easier and safer route.

Going live with ASP.NET vNext 1.0.0-rc1-update1

We started to work on project during beta 7 & managed to implement most of functionality in version 1.0.0-rc1-update1. We are mostly using MVC for authenitication and web api to serve data. Most of the functionality is in client-side Angular.
Considering RC2 is now out, we don't have time to upgrade due functional deadline.
So the question is can we go-live with this version or MUST upgrade to RC2?
RC1 had a go-live license however since RC2 has been released RC1 is no longer supported. In other words, if you hit an issue no one will spend time investigating it. Given that the final 1.0 is planned to be shipped in the next few weeks and that changes between RC2 and RTW are minimal moving to RC2 is not a bad idea - it will be quick and easy to move from RC2 to the 1.0.0 final. Here are some resources that will help you migrate your RC1 to RC2:
https://docs.asp.net/en/latest/migration/rc1-to-rc2.html
https://github.com/aspnet/Home/issues/1381

Resources