I Can't Target .Net Framework in Visual Studio 2019 - c#

When I create a Project in Visual Studio, I can't choose .net framework as my target framework, I only have the choice between .net core 3 and .net 5, I have already downloaded and installed .net framework 4.8 Developer Pack but nothing changed.

You need to pay attention to the template you create your project with - some are e.g. "Console App" (which is for .NET Core - 3.1 or 5.0), while another might be called "Console App (.NET Framework)" which is for the various versions of the full, classic .NET framework:
If you picked the .NET Core template - then yes, you cannot target the "classic" .NET Framework - just create the correct project type from the correct template and you should be fine

Related

Project '..' targets 'net5.0'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.7.2'

I created my initial project that targets Framework version v4.7.2. I needed to add a class library in my project using visual studio 2022 Community. While doing so, VS2022 gave me only 4 options to choose from for setting Target Framework (.Net Standard 2.0, .Net Standard 1.0, .Net 5.0, .Net 6.0). This feature isn't there in VS2019 Community. I selected .NET 5.0
Now this class library cannot be referenced by my initial project. I think I need to update .NET Core SDK but don't know which version (if I am correct in my assumption).
Please help. Thanks
You should add a class library, which is supported .NET Framework.
In the one project, all classes are the same target output (.NET Core or .NET Framework)
Referred project and reference project are the same target output.
My case:
I created Winform Application(.NET Core), then add Junit Project(.NET Framework) referring to Winform Application and they are conflict due to different target.
My Solution:
I changed Winform Application from .NET Core to .NET Framework and they are working.
Hope to help you!!!

VS 2017 ASP.Net Core Web Application cannot target .Net Framework

I seem to have lost the ability to create an ASP.Net Core Web Application that targets the .Net Framework. The dropdown is disabled where it used to be enabled.
I have .Net 471, 472 SDKs and targeting packs installed and my VS2017 is updated to 15.7.6.
I've tried uninstalling/reinstalling the .Net 4.7x SDKs and targeting packs but that didn't help.
Is there something short of reinstalling Visual Studio from scratch that I can do?
The project template only supports .NET Core. However, once you create the project, you can edit your .csproj and change:
<TargetFramework>netcoreapp2.1</TargetFramework>
To:
<TargetFramework>net472</TargetFramework>
Save, and you're good to go.
It would appear that there are two templates now that can create an ASP.Net Core Web Application.
Under .Net Core
And under Web
To get the option of selecting to target .Net Core or .Net Framework, you must use the template under Web.

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

Running .NET core App on .NET framework

I was reading this article: https://blogs.msdn.microsoft.com/cesardelatorre/2016/06/28/running-net-core-apps-on-multiple-frameworks-and-what-the-target-framework-monikers-tfms-are-about/ about using different monikers for .NET core app and I was wondering what is the difference between creating ConsoleApp with .NET framework 4.5.1 and creating ConsoleApp .NET core with moniker set to .net framework 4.5.1.
Is it expected to have any differences in behavior? The only difference I can think of is that the first one will use csproj and the second one will use xproj (ok xproj is deprecated now, so new csproj format). I'm asking this question because my current app is built on top of .NET framework 4.5.1 and I was thinking of migrating it to .NET core on top of .NET framework.
Calling the project.json build tools the ".NET Core SDK" was only partially true: the tools can be used to build for runtimes other than .NET Core, i.e. .NET Framework. A console app built for .NET Framework using project.json is exactly the same as a console app built for .NET Framework using csproj.
The new csproj format tries to correct this common mixup. You'll notice in VS 2017, projects use the ".NET SDK", aka "Microsoft.NET.Sdk" (dropped Core from the name). This new SDK can be used to build .NET Framework, .NET Standard, and .NET Core projects.

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