Can .NET 5 Runtime run .NET 3.1 application? - compatibility

I have an exe built using .NET Core 3.1. If the installer is run on a system that has .NET 5 runtime installed, it is still prompting the user to install .NET Core 3.1.
How to make this exe run on a system just having .NET 5 runtime installed?

You cannot run a .NET 3.1 app on the .NET 5 runtime. A 3.1 app requires that you install the runtime for .NET 3.1 as well. Major version changes indicate a new runtime (e.g. .NET Core 2 requires the .NET Core 2.x runtime, .NET Core 3 requires the .NET Core 3.x runtime).
Note that you can write code for an app that runs on both .NET 3.1 and .NET 5 but they are compiled separately, produce separate binaries and dependencies and the appropriate version would need to be deployed onto the target machine based upon the runtime that is installed.
.NET and .NET Core official support policy

Related

.NET Core 6 microsoft.data.sqlclient 4.1.0 in runtimes\win\lib\netcoreapp3.1

I'm upgrading my application from .NET Core 3.1 to 6.0 and in the process moving the sqlclient from 2.0.0 to 4.1.0
I was expecting 4.1.0 version be in runtimes\win\lib\net6.0?
From the debugger Modules I see it's still in runtimes\win\lib\netcoreapp3.1
Is there some other SQL Client package for .NET 6?
I've removed all the old .NET Core 3.1 bits from my application. I then ran it and looked again at the loaded modules. Everything points to the application being a full on .NET 6 application.
It's appearing that the location of the sqlclient is just weird or outright wrong:
Microsoft.Data.SqlClient.dll C:\Temp\Dyer\runtimes\win\lib\netcoreapp3.1\Microsoft.Data.SqlClient.dll 4.1.0.0

Upgrading Web Forms ASP.Net 3.5 to 4.7

We have a web forms project that is running on ASP.Net 3.5 and we need to upgrade all the way to 4.7. Telerik controls are involved which I know will need to be upgraded as well. This is a large web application and I know there is not quick solution, but trying to figure out how to get started. Does anyone have any recommendations for such a task.
It depends on the CLR for the .Net framework you are using.
.Net Framework 2.0, 3.0, and 3.5 uses CLR 2.0
.Net Framework 4, 4.5, and 4.5.1 uses CLR 4.0
CLR 3.0 does not exist
An application developed in .Net 2.0 or 3.0 can run in a 3.5 framework because the target CLR is the same
But an application developed in .Net 3.0 will not run in a 4.5 framework because now the target framework is different (CLR 4)
Solution
To configure your application to run on .Net Framework 4 or 4.5:
Create a text file that has the same name as your application, and add the file extension .config. For example, if your application is named abc.exe then your application configuration file must be named abc.exe.config.
Add the element as follows to the application configuration file:
`<configuration>
<startup>
<supportedRuntime version="version"/>
</startup>
</configuration>`
Check framework upgrade guidelines here: https://social.msdn.microsoft.com/Forums/vstudio/en-US/d4c6adee-4dd5-435d-a021-4fd9d4c6f7c0/net-framework-upgrade-from-35-to-471?forum=netfxsetup

Asp.Net Core 2.1 with .Net Framework 4.6.1 error after deployment using dotnet publish or visual studio publish

I am trying to deploy Asp.Net Core 2.1 application with target framework 4.6.1 on server. I am using dotnet publish command and copying the publish folder on the server where deployment is intended. Everything works fine on local machine. But when I am trying to run the application on the server , it is throwing the exception ".Net Framework 4.6.1 not installed, please install it.".
I thought .Net framework is not installed but when I checked installed software , I can see .Net 4.6.1 is installed. Not sure why the error is occurring.
Here is screenshot for the application error and installed software
That error is odd, since you do indeed seem to have that version installed. However, I believe it may be a red herring. I haven't personally tried to run ASP.NET Core 2.1 on .NET Framework, but I suspect it may not work at the moment. The full framework support depends on .NET Standard compatibility which only goes up to .NET Core 2.0. (With .NET Standard 2.0). ASP.NET Core requires .NET Core 2.1. You can try targeting a later version of .NET Framework - something recent like 4.7.2. You may need to downgrade to ASP.NET Core 2.0, if you need to target .NET Framework.
Your list only shows development packages to support targeting and developing for .NET Framework 4.6.1
See How to: Determine which .NET Framework versions are installed for ways to check the .NET Framework version on the machine.

.NET Core and .NET Framework 4.7 edit project option not available

When I create a .NET Core 2.0 Project I have to select both .NET Core version (2.0) and a .NET Framework version (4.7). But when I edit the project, I cannot change the .NET Framework version. Why is that? I am trying to use the function app.UseRewriter(options); and it is unavailable so I am theorizing that I have the wrong .NET Framework
I guess I just needed this package
Install-Package Microsoft.AspNetCore.Rewrite -Version 2.0.1
Yes, that's a confusing GUI. That got me mad as well (like some other stuff in Visual Studio if you are used to Jetbrains-IDEs).
You have chosen an ASP.NET Core Web Application as project type. So the only target frameworks that are being offered to you are .NET Core 1.0, 1.1 and 2.0 (in case you have installed 2.0, like you did).
Chose Web -> ASP.NET Web Application (.NET Framework) to get what you want.

Deployment of asp.net 3.5 website: Requirements

If i create website in asp.net 3.5 then does it require to have asp.net 2.0 framework in deployment enviorment?
Does website deployment project automatically include prerequisite for deployment or we should initially required to install all prerequisite at deployment enviounment before installing website.
You will need to install the Microsoft .NET Framework 3.5 Service Pack 1 on your webserver in order to run an ASP.NET 3.5 website.
A website deployment project will not do this for you - you will need to install this prior to your deployment to the webserver.
Yes, unlike going from .NET 1.1 to .NET 2.0, the .NET 3.0 and .NET 3.5 runtimes are layered on top of .NET 2.0 and require the runtimes to be installed.
As mentioned below though, the installer of .NET 3.5 will take care of this for you.
The 3.5 framework runs on top of the 2.0 runtime. If you install the 3.5 framework you will get the 2.0 runtime on the server.
A website deployment project will not install any framework version on the server. The purpose of the deployment projects are to compile your website pages so they don't have to JIT compile on the first requests to your website.

Resources