简体   繁体   中英

Visual Studio 2017, use new style csproj by default when creating new projects

Is there any way to use the new style csproj (with SDK, PackageReferences, and no need to use compile include etc.) by default when creating a new .net framework 4.5.2 project in Visual Studio?

At the moment I'm creating a .net standard project and then changing it to .net 4.5.2, or just manually changing the csproj, but even though this isn't that slow, I would rather it happen automatically obviously.

Old style :

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
...

New Style:

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <TargetFramework>net452</TargetFramework>
...

You can create new style .cproj by hand. After that you can export project template (Project->ExportTemplate)

导出项目模板

Specify project name, description and set checkbox 'Automatically import the template into Visual Studio'

选择模板选项

After that you can use this template in Visual Studio when creating new project 创建新项目

After project template have been created, you can customize them

Customize project and item templates

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM