Search code examples
c#.netvisual-studiocsproj

How to create an SDK-style .NET Framework project in VS?


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.


Solution

  • 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.

    enter image description here