![](/img/trans.png)
[英]Is there Blazor WASM + WebAPI project template like there's `dotnet new react`?
[英]Multi project template for dotnet new
我正在創建一個多項目模板,其中包含一些可選項目和解決方案文件夾。 我已經通過 github 中的很多不同的文檔和代碼來實現這一點,但收效甚微。 我真的很感激有人能給我一些關於這些問題的澄清嗎?
使用上面的 VSTemplate 我試圖創建一個多項目模板,使用 ProjectCollection 標簽,當我運行 dotnet run 命令時,模板被執行但項目沒有被創建。
<ProjectTemplateLink ProjectName="$safeprojectname$.Forms.Plugin.Abstractions"> Forms.Plugin.Abstractions\\Forms.Plugin.Abstractions.vstemplate </ProjectTemplateLink> <ProjectTemplateLink ProjectName="$safeprojectname$.Forms.Plugin.iOS"> Forms.Plugin.iOS\\Forms.Plugin.iOS.vstemplate </ProjectTemplateLink> <ProjectTemplateLink ProjectName="$safeprojectname$.Forms.Plugin.iOSUnified"> Forms.Plugin.iOSUnified\\Forms.Plugin.iOSUnified.vstemplate </ProjectTemplateLink> <ProjectTemplateLink ProjectName="$safeprojectname$.Forms.Plugin.Android"> Forms.Plugin.Android\\Forms.Plugin.Android.vstemplate </ProjectTemplateLink> <ProjectTemplateLink ProjectName="$safeprojectname$.Forms.Plugin.WindowsPhone"> Forms.Plugin.WindowsPhone\\Forms.Plugin.WindowsPhone.vstemplate </ProjectTemplateLink> </ProjectCollection>```
我們可以使用 template.json 文件創建多項目模板嗎?
如果有人能幫助我開始,將不勝感激。
通過在 template.json 文件中進行更改,我設法使多項目模板正常工作
這是最終的 template.json 文件看起來像
This is my updated template.json file
{
"author": "Libin Joseph",
"classifications": ["Xamarin", "Sample"],
"name": "Sample Enterprise Template",
"tags": {
"language": "C#"
},
"identity": "libin.sampletemplate",
"shortName": "sampletemplate",
"sourceName": "SampleTemplate",
"guids": [
"{41F47D3C-C9E4-45D1-A289-3BDC31E44C19}",
"{980FBE34-066B-4E87-AFC9-C3205844D980}",
"{FD448FB5-B24B-4CD2-8E3C-2500CF0E4601}",
"{D8FC665A-7739-4ADE-85E9-C69AA107EEE6}",
"{92D25D7D-F637-4634-B939-BB38DE53B606}",
"{5D52EDF7-47B8-48D2-83B6-104B18568CE4}",
"{12E171B1-0F36-401A-A171-614F1A1C83E9}",
"{7A4597AE-2C39-4197-94C9-F5B6B45B2106}"
],
"primaryOutputs": [{
"path": "SampleTemplate\\SampleTemplate.Android\\SampleTemplate.Android.csproj"
},
{
"path": "SampleTemplate\\SampleTemplate.iOS\\SampleTemplate.iOS.csproj"
},
{
"path": "SampleTemplate\\SampleTemplate\\SampleTemplate.csproj"
},
{
"path": "SampleTemplate.UnitTest\\SampleTemplate.UnitTest.csproj"
},
{
"path": "SampleTemplate.UITest\\SampleTemplate.UITest.csproj"
},
{
"path": "SampleTemplate.Core\\SampleTemplate.Core.csproj"
}
],
"exclude": ["**/[Bb]in/**", "**/[Oo]bj/**", ".template.config/**/*", "**/*.lock.json"]
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.