2017-04-12 75 views

回答

2

构建您自己的包含两个项目的模板。这非常简单。在Visual Studio中创建和设置的几个项目,并把.template.config\template.json文件根目录解决方案级别:

enter image description here

template.json内容:

{ 
    "classifications": [ "Web" ], 
    "name": "ASP.NET Core project AND xUnit project both targeting .NET 461", 
    "identity": "fweb", // Unique name for this template 
    "shortName": "fweb", // Short name that can be used on the cli 
    "tags": { 
     "language": "C#" // Specify that this template is in C#. 
    }, 
    "sourceName": "FullWebApp", 
    "preferNameDirectory": "true" 
} 

然后与解决方案的路径运行dotnet new --install作为参数:

dotnet new --install "D:\YourFullPath\DotNetTemplates" 

模板fweb已创建!转到目标文件夹并尝试从模板创建新的项目:

dotnet new fweb 

它的完成。了解更多关于模板包装(的NuGet)和名称参数化的位置:

How To Create A dotnet new Project Template In .NET Core

How to create your own templates for dotnet new

+0

我在https://github.com/dotnet/dotnet有一个控制台项目和单元测试项目的样本-template采样/树/主/ 05-多项目 –

相关问题