How to Update Blazor Server App from .net core 6.03, to 6.04 - visual-studio

I have a .net core Blazor Server App which is currently using version 6.03 of .net core.
Version 6.04 came out a few days ago, and I need to upgrade the project and then publish it so it is using the new bits.
I have:
Install the latest SDK from here which includes 6.04.
I also used Nuget to ensure all libs are on 6.04.
However, when I open the project, and check the file versions, it is still using 6.03.
I have looked for any setting in the project file that would indicate which version of .net 6, it is using, but I don't see any such setting. I only see this setting:
<TargetFramework>net6.0</TargetFramework>
Is there some way to get VS to use 6.04 instead of 6.03?

After quite a bit of working with this, I found that the minor version is tied to the Version of Visual Studio that you are using.
So, I was using VS 2022 Version 17.2.0 Preview 4, and the .net 6.0.4 bits had not been released yet for this version. So those bits are not accessible from this version.
However, the 6.0.4 bits have been released for VS 2022 Version 17.1.5. So by downloading and installing 17.1.5, the project then opened up using 6.0.4 without any other changes.
I am sure that soon the bits will be released for the 17.2 version soon.

Related

VS 2019 Project Target Framework Not Installed - .Net Framework 4.0

Just installed VS 2019 Pro on a new system. When I open a solution with .net 4.0 project, I get this error: Project Target Framework Not Installed.
When I choose download it, it goes here but does not have option for .net framework 4.0.
In project settings there is no option for .Net Framework 4.0 in targeting framework:
https://dotnet.microsoft.com/en-us/download/visual-studio-sdks?cid=getdotnetsdk
I have tried installing 4.6.2, 4.5.2, etc.
How can I get this project to open? It opens on my other machine. It has these options for Target framework in project settings:
Please don't say change the framework version, we need this older version for very old computers running XP and Win 7 that cannot be upgraded.
thank you
You have to go directly to their download site. As shown in another correct answer that was downvoted, it's still available even though it's past end-of-life.
https://stackoverflow.com/a/72870727/9008140
You can package the install files with your app just in case, although most likely your installer will see that it's missing and download it anyway.
You can try downloading .Net 4.0 here: https://dotnet.microsoft.com/en-us/download/dotnet-framework/net40
Mandatory warning: Installing an old, unmaintained .Net framework comes with security risks. It's up to you to determine how much those Windows XP PCs are vulnerable and manage said risks.

.Net 6 Not show in Visual studio TFM,

It's weird.
If I create a new project and choose DotNet 6 framework by Visual Studio 2022. I will get the NETSDK1045 error code.
But create a new project from the console, everything is Ok.
Run dotnet --list-sdks and see if the expected .NET6 version is installed.
My guess is that you might have x86 issue. If you have installed x64 version, install x86 version and vice versa and test if the issue is gone.
You can also try to repair your VS 2022 instance and/or upgrade to latest official version.
There is also a small probability that you select a project type that does not supports .NET 6 (for example .NET Framework Web App project type).
Also you may check your path contains the dotnet folders in the correct order for your architecture.
References:
https://learn.microsoft.com/en-us/dotnet/core/tools/sdk-errors/netsdk1045
VS2017 : Target framework drop down does not show .NET Core 2.1 option

.NET core 3.0 RC vs Preview 9

I just recently installed preview 9. Looks like a Release Candidate will be available soon. This stuff is changing fast.
https://github.com/dotnet/core/blob/master/roadmap.md
Just going off memory, will one need to uninstall Preview 9 before installing the RC ?
The installers should automatically uninstall previous versions of the same release band, so the preview 9 installer (windows, judging from the visual-studio tag), should have uninstalled the preview 8 if present. A possible RC (if one is released before the final 3.0 version end of september) should also uninstall the preview.
But it is not necessary to uninstall it if you want to use the previews / RCs side-by-side. The side-by-side mechanism is the same as for different version of .NET Core and the .NET Core SDK. Not all projects need to use the same tooling / runtime (e.g. when you are migrating projects from preview8 to preview9 consecutively and thus want to work with both versions side-by-side).

What is the best way to install .Net Core SDK 2.2 for development

I am going through a tutorial to create a Razor page App in Visual Studio 2019:
https://learn.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/razor-pages-start?view=aspnetcore-2.2&tabs=visual-studio
On this page it lists the prerequisites:
1) Visual Studio 2019 with the ASP.NET and web development workload
2) .NET Core SDK 2.2 or later
I downloaded the Visual Studio 2019 install so I have that ready to go.
But when I click on the ".NET Core SDK 2.2 or later" link it takes me here:
https://dotnet.microsoft.com/download/archives
And when I click on that link it takes me here:
https://dotnet.microsoft.com/download/dotnet-core/2.2
And when I click on ".Net Core Downloads" it takes me here:
https://dotnet.microsoft.com/download/dotnet-core
And finally when I click on .Net Core 2.2 (Current) it takes me here:
https://dotnet.microsoft.com/download/dotnet-core/2.2
Ah finally I am on the v2.2.6 page but now the installs are split in 2.
1) Build apps - SDK 2.2.401
2) Run apps - Runtime 2.2.6
I have never seen this before, having to install two pieces.
Question number 1: If I just install Visual Studio 2019 will I have everything I need for development? Or do I need to install .Net Core 2.2.n also.
Question number 2: If I need to install .Net Core 2.2.6 (current) do I need to install both SDK and Runtime separately? And if so is there a single file to install both at the same time anywhere?
Or do I need to install both (for windows):
SDK 2.2.401 - NET Core Installer: x64
Runtime 2.2.6 - ASP.NET Core Installer: x64
I guess I will start experimenting.
Just confusing. I guess list-sdks would then show 2.2.401 and not 2.2.6. And then there must be separate list commands for runtime and release?
Yep confusing.
I know preview 3 is out.
They have a note here at the top it is coming out:
.NET Conf 2019
.NET Core 3.0 launches at .NET Conf 2019 September 23-25, a free, virtual developer event. -
https://dotnet.microsoft.com/download/dotnet-core/2.2
If I just install Visual Studio 2019 will I have everything I need
for development? Or do I need to install .Net Core 2.2.n also.
When you install VS, you can configure your specific development environment by choosing corresponding workloads and components according to your needs. If you want to develop .net desktop projects like winform and wpf, you should choose .Net desktop development workload, and if you only want to develop Razor Page app, you just need to install VS2019 with ASP.NET and web development workload.
Normal if we choose this workload, vs installer will install .net framework(4.0 to 4.6) and asp.net core 2.1 for you by default. However, there's no single component for .net core SDK 2.2 when installing. So apart from VS with ASP.NET and web development workload, we need to manually install the .net core 2.2 SDK.
If I need to install .Net Core 2.2.6 (current) do I need to install
both SDK and Runtime separately? And if so is there a single file to
install both at the same time anywhere? Or do I need to install both
(for windows)
As for question2, I never install the sdk in that way. I use another way to download and install the sdk. Here is the download link I use.I think you only need to install this SDK:
The SDK includes everything you need to build and run .net core applications while the runtime includes everything you need to run .net core applications.The runtime is included in the SDK. (So you don't need to install the runtime separately)
In summary, to develop razor pages, you need to install VS with ASP.NET and web development workload and the SDK mentioned in the picture above. Just do as the document suggests. Hope it helps:)
I too was confused by this. When I finished installing ONLY the SDK .NET Core Installer: x64 (file dotnet-sdk-3.0.100-win-x64.exe) the installer showed this message:
The following were installed at: 'C:\Program Files\dotnet'
• .NET Core SDK 3.0.100
• .NET Core Runtime 3.0.0
• ASP.NET Core Runtime 3.0.0
• .NET Core Windows Desktop Runtime 3.0.0
As you can see, only running the SDK installer also installs the runtime, the ASP.NET runtime, and the Desktop runtime. So it's not necessary to install these separately.
TL;DR If you are developer just download the SDK Installer and run that

How to upgrade core 2.1.1 to core 2.2.3

The official documentation does not work.
Do I need VS 2017 Preview?! Or to restart my pc every time I install "Latest stable 2.2.3" SDK's? Perhaps its not so stable? Should I try 2.2.1 lol
VS 2015 will work up for up to .NET Core 1.1 (now EOL). VS 2017 will work for up to .NET Core 2.2. .NET Core 3.0+ requires VS 2019.
It's not clear what your exact issue is, but the process is basically this:
Download the appropriate .NET Core SDK version. Be careful because the SDK version is somewhat independent of the .NET Core version. Pay attention to specifically what version of .NET Core the SDK supports, not the version number of the SDK itself.
Edit your project file and change the target to the new .NET Core version. This will be the minor version, not patch releates. In other words, for any .NET Core 2.2.X, you'd use netcoreapp2.2 as your target.
That's it. After you save, any NuGet dependencies of your project, such as Microsoft.AspNetCore.App will update to the latest version within that target, i.e. 2.2.X. However, note that some packages may not always have new versions. Most of the major parts of ASP.NET Core, for example, change enough with each version that the NuGet packages get bumped as well. However, it is possible that you may still use a 2.1.X package if nothing changed in that for 2.2. In any case, you'll be able to see in Visual Studio if it's fully updated or not.

Resources