Reputation: 9466
Is it possible to create an SDK-style
.NET Framework
project in Visual Studio (to be more specific I use the latest VS2019)? Or does it still require manual manipulations?
<Project Sdk="Microsoft.NET.Sdk">
I'm interested in creating a new project, not in migrating existing project from old .csproj
file style to the new .csproj
SDK-style
.
I've already edited .csproj
files manually many times but it's super inconvenient.
Upvotes: 57
Views: 35482
Reputation: 1100
Easyest way for do that - just use template for .Net Core
choose any framework.
When VS generate for you file *.csproj, open it by click mouse
delete 2 lines <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable>
and change TargetFramework to net48 (in case you use NetFramework 4.8)
Upvotes: 1
Reputation: 4373
Thanks to the comments on the previous answer which pointed to upgrade-assistant
. Here are the commands I used:
Install the tool:
$ dotnet tool install -g upgrade-assistant
Then either run interactively and select "Upgrade project features > Convert project to SDK style (feature.sdkstyle)":
upgrade-assistant upgrade
Or do this in one-shot on the cli like this:
upgrade-assistant upgrade MyProj/MyProj.csproj -o feature.sdkstyle
Upvotes: 16
Reputation: 5986
We have to create a sdk-style .net framework project manually. By setting the TargetFramework
to (for example) net472
.
You can refer to the following steps to make it.
First, we need to create a Class Library (.NET Standard) project.
Second, we need to modify the csproj file.
The initial file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
</Project>
You can edit it to:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
</PropertyGroup>
</Project>
Finally, you can get a sdk-style .net framework project.
Upvotes: 51