Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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>
...
like image 942
Yair Halberstadt Avatar asked Jun 19 '18 16:06

Yair Halberstadt


People also ask

How do I create a new project to an existing solution in Visual Studio 2019?

To add an existing project to a solutionOn the File menu, point to Add, and click Existing Project. In the Add Existing Project dialog box, locate the project you want to add, select the project file, and then click Open. The project is added to the selected solution.


1 Answers

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

like image 166
Dmitry Kolchev Avatar answered Oct 14 '22 15:10

Dmitry Kolchev