How to change the target framework version of asp 5 project? - c#

When creating a project in VS2015 it asks you the target .NET framework version. I chose .NET 4.6 but now I want to revert back to 4.5. In the past, you were able to change the target framework version from the project tab but now in asp 5 it seems like there is no way to do it ? Any ideas ?

In order to change the target framework you need to change the dnx entry in project.json. You can upgrade from 4.5.1 to 4.6 by changing "dnx451" to "dnx46".
Be aware that there are still some problems running latest framework version in web environment. E.g. IIS not picking up .NET 4.6 and running in 4.5.1 by default as explained in this this answer.

Right click your project (not solution) -> select properties -> under Application tab select Target Framework -> change to desired framework.

Related

.Net Framework Debug window is not working

I have a problem of debugging. I have the window created with the buttons, labels and everything, but when i try to debug it, the UI/GUI doesn't show up.
I am on windows 10 Visual studio 2019, with Developers mode on (since Visual Studio is asking for it when creating WFA or Windows Forms App). I have .Net Framework 3.5 Installed and i dont see the reason why it shouldn't work. I see it every time i create a project.
The Application i am trying to create is a .Net Framework WPF
The Reason why the Debugging doesn't show the UI is because of the .Net Framework you are using is not compatible with the .Net Framework version your project is set to work on
you can set the normal .Net Framework version you want your Project to work on in the Section when the Visual Studio is asking for the Name of the Project, the Solution Name and the path. At the very bottom, you will see something along the lines of ".Net Framework". Click on that and choose any Version you want your project to work on. (Warning Note: .Net framework 4.5 and .Net Framework 4.8 may have compatibility issues. This info is in th link below)
You would need .Net Framework 4.5 or above
I highly recommend getting .Net Framework 4.8 since it is a .Net Framework version that supports .Net Framework 4.7.2
I had this issue and when i installed .Net 4.8, the Debugging instantly started working.
For More Information, Check out this Link:
https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/runtime/4.5-4.8
[18th April 2022] - Edit: .Net 6 is a thing. You can use that instead of .Net Framework 4.8

This setup requires .NET Framework version 4.5

I have migrated a project from .NET Framework 4 to .Net Framework 4.5. When I create the setup project, and run the installer, i get the error message "This setup requires .NET Framework version 4.5". This is the version used in each project and it is installed on my local machine.
How can this problem be solved?
If you use Visual Studio :
Select Project -> Properties -> publish -> required components
and make sure Net Framework 4.5 is selected

Cannot target .Net 2.0 in Visual Studio 2015

I have a project that targets both .Net 2.0 and .Net 4.5. I built+published it successfully in Visual Studio 2013. The .Net configuration in the .csproj file still says
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
Yet, when I open the project in VS 2015, it targets .Net 4.5.
I have 2.0 available in the Target Framework dropdown:
when I click ".Net Framework 2.0" it gives me a popup saying
Changing the target framework requires that the current project be closed and then reopened.
Any unsaved changes within the project will be automatically saved.
Changing Target Framework my require manual modification of project files in order to build.
Are you sure you want to change the Target Framework for this project?
When I click yes, the target framework goes back to 4.5 and nothing else happens.
I've tried reopening the project and VS, with no luck.
I've tried running the .Net 3.5 installer (which apparently includes 2.0), but it says I need to use "Turn Windows Features on/off"
I've ensured the .Net 3.5 Windows Feature is enabled.
And now I'm out of ideas. Has anyone else encountered this?
Running Windows 7.
In case, the .NET Framework 2.0 is corrupted, use the .NET Framework setup verification tool: https://blogs.msdn.microsoft.com/astebner/2013/11/06/net-framework-setup-verification-tool-and-cleanup-tool-now-support-net-framework-4-5-1/ to verify and once it found any corrupted, you can use the .NET Framework Repair Tool: https://www.microsoft.com/en-us/download/details.aspx?id=30135 to repair it.
Or under ‘Turn Windows Features on or off’, uncheck .NET Framework 3.5 (includes .NET 2.0 and 3.0), then check it.
As Hans Passant mentions in the comments, I apparently(?) edited the .csproj to use different frameworks for different configurations. I swear this didn't cause any issues in VS 2013.
But in any case, I verified using ILSpy that the .dll being generated is .Net 2.0, even though the dropdown says 4.5. So I guess all's well that ends well?

How do I change the .NET framework bootstrapper package?

I have a C# project that I previously had targeting .NET 4.0, and now I want to target .NET 3.5, but I am getting this warning:
The version of the .NET Framework launch condition '.NET Framework 3.5' does not match the selected .NET Framework bootstrapper package. Update the .NET Framework launch condition to match the version of the .NET Framework selected in the Prerequisites Dialog Box.
But when I look under Publish->Prerequisites, .NET framework 3.5 SP1 is checked.
What do I need to do to get rid of this warning? There is no checkbox for .NET framework 3.5 without SP1, can I just not check any box?
I checked the launch condition, and the .NET framework launch condition version is already 3.5.
I found that I needed to right click on my Setup and Deployment project, hit properties, go to prerequisites, and uncheck .NET framework 4 and check .NET framework 3.5.
I had done that for all of the projects but for the setup and deployment project. I didn't realize it had its own prerequisites section.
It's likely coming from the installer project that you have within the solution. I'm guessing you do have one, as it's the only place I've seen Visual Studio talk about launch conditions.
Select it in Solution Explorer, and then at the top click the little icon with binoculars (Launch Condition Editor).
Under Launch Conditions, right click on the .NET Framework and open the properties, and then change the Version to .NET Framework 3.5.
I just got that error and i fixed it easily by double clicking the error message.
A window shows up. Then you can modify the properties of the different elements on the page by right clicking them -->> properties.
Just make sure all the items on this page have the desired framework version.
PS: on VS2010

How to recompile program for .Net Framework 3

I am using VS 2010 and i was trying to create program based on .Net Framework 4 and when i done it, program was working only on my computer, coz nobody of my friends don't have .Net framework 4 installed.
How to recompile program for .Net Framework 3 in Visual Studio 2010?
right-click on the project properties and change Target framework from .NET Framework 4 to .NET Framework 3
Go to the Project menu
Click on the Your Project Properties
On the Application Tab, select .NET Framework 3.5 from the Target Framework dropdown.
Simply change project settings.
Or use command-line csc to compile
You can switch the target framework in Visual Studio 2010 between .NET 2.0, 3.0, 3.5, and 4.0.
See How to: Target a Specific .NET Framework Version or Profile on MSDN.
As noted on that page, you might have to install 3.0 by hand since Visual Studio 2010 comes only with .NET 4.0. But once you install 3.0, you will be able to target it.
From the project in Visual Studio 2010, right click on the project and select Properties. Click on the Application tab, and from the Target Framework dropdown, select .NET Framework 3.0.
Project ->
Properties ->
Application (tab) ->
Target framework: .NET Framework 3.0
This MSDN page will help guide you with additional details.
And, not to be a schmuck, but you could have received a faster answer by Googling "compile .net framework 3.0 visual studio 2010" and noting that the first link is How To: Change the Target .NET Framework.

Categories