Yair Halberstadt
Yair Halberstadt

Reputation: 6821

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

Upvotes: 19

Views: 2200

Answers (1)

Dmitry Kolchev
Dmitry Kolchev

Reputation: 2216

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

Export project template

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

Select Template Options

After that you can use this template in Visual Studio when creating new project Create New Project

After project template have been created, you can customize them

Customize project and item templates

Upvotes: 12

Related Questions