2017-04-12 76 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-多項目 –

相關問題