在VS2017中导出新项目模板后。使用模板创建新项目时,该项目为空。该项目使用.NET Core 2.1构建。我读过其他stackoverflow帖子,并看到添加true当我添加它时,尽管在VS中创建新项目时找不到模板。
这是vstemplate文件。
<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Project">
<TemplateData>
<Name>CCCCore2Angular6Template</Name>
<Description><No description available></Description>
<ProjectType>CSharp</ProjectType>
<ProjectSubType>
</ProjectSubType>
<SortOrder>1000</SortOrder>
<CreateNewFolder>true</CreateNewFolder>
<CreateInPlace>true</CreateInPlace>
<DefaultName>CCCCore2Angular6Template</DefaultName>
<ProvideDefaultName>true</ProvideDefaultName>
<LocationField>Enabled</LocationField>
<EnableLocationBrowseButton>true</EnableLocationBrowseButton>
<Icon>__TemplateIcon.ico</Icon>
</TemplateData>
<TemplateContent>
<Project TargetFileName="CCCCore2Angular6Template.csproj" File="CCCCore2Angular6Template.csproj" ReplaceParameters="true">
<Folder Name="Properties" TargetFolderName="Properties">
<ProjectItem ReplaceParameters="true" TargetFileName="launchSettings.json">launchSettings.json</ProjectItem>
</Folder>
<Folder Name="wwwroot" TargetFolderName="wwwroot" />
<Folder Name="ContractorConnection" TargetFolderName="ContractorConnection">
<Folder Name=".git" TargetFolderName=".git" />
<Folder Name="e2e" TargetFolderName="e2e">
<Folder Name="src" TargetFolderName="src">
<ProjectItem ReplaceParameters="true" TargetFileName="app.e2e-spec.ts">app.e2e-spec.ts</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="app.po.ts">app.po.ts</ProjectItem>
</Folder>
<ProjectItem ReplaceParameters="true" TargetFileName="protractor.conf.js">protractor.conf.js</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="tsconfig.e2e.json">tsconfig.e2e.json</ProjectItem>
</Folder>
<Folder Name="src" TargetFolderName="src">
<Folder Name="app" TargetFolderName="app">
<ProjectItem ReplaceParameters="true" TargetFileName="app.component.css">app.component.css</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="app.component.html">app.component.html</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="app.component.spec.ts">app.component.spec.ts</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="app.component.ts">app.component.ts</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="app.module.ts">app.module.ts</ProjectItem>
</Folder>
<Folder Name="assets" TargetFolderName="assets">
<ProjectItem ReplaceParameters="false" TargetFileName=".gitkeep">.gitkeep</ProjectItem>
</Folder>
<Folder Name="environments" TargetFolderName="environments">
<ProjectItem ReplaceParameters="true" TargetFileName="environment.prod.ts">environment.prod.ts</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="environment.ts">environment.ts</ProjectItem>
</Folder>
<ProjectItem ReplaceParameters="false" TargetFileName="browserslist">browserslist</ProjectItem>
<ProjectItem ReplaceParameters="false" TargetFileName="favicon.ico">favicon.ico</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="index.html">index.html</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="karma.conf.js">karma.conf.js</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="main.ts">main.ts</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="polyfills.ts">polyfills.ts</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="styles.css">styles.css</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="test.ts">test.ts</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="tsconfig.app.json">tsconfig.app.json</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="tsconfig.spec.json">tsconfig.spec.json</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="tslint.json">tslint.json</ProjectItem>
</Folder>
<ProjectItem ReplaceParameters="false" TargetFileName=".editorconfig">.editorconfig</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName=".gitignore">.gitignore</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="angular.json">angular.json</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="package.json">package.json</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="package-lock.json">package-lock.json</ProjectItem>
<ProjectItem ReplaceParameters="false" TargetFileName="README.md">README.md</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="tsconfig.json">tsconfig.json</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="tslint.json">tslint.json</ProjectItem>
</Folder>
<Folder Name="Controllers" TargetFolderName="Controllers">
<ProjectItem ReplaceParameters="true" TargetFileName="BaseController.cs">BaseController.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="ValuesController.cs">ValuesController.cs</ProjectItem>
</Folder>
<Folder Name="Models" TargetFolderName="Models">
<ProjectItem ReplaceParameters="true" TargetFileName="UserModel.cs">UserModel.cs</ProjectItem>
</Folder>
<Folder Name="Services" TargetFolderName="Services">
<ProjectItem ReplaceParameters="true" TargetFileName="SessionExtensions.cs">SessionExtensions.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="SessionFields.cs">SessionFields.cs</ProjectItem>
</Folder>
<ProjectItem ReplaceParameters="false" TargetFileName="__PreviewImage.png">__PreviewImage.png</ProjectItem>
<ProjectItem ReplaceParameters="false" TargetFileName="__TemplateIcon.png">__TemplateIcon.png</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="appsettings.json">appsettings.json</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="appsettings.Development.json">appsettings.Development.json</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="Program.cs">Program.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="README.txt">README.txt</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="Startup.cs">Startup.cs</ProjectItem>
</Project>
</TemplateContent>
</VSTemplate>
答案 0 :(得分:1)
您需要确定使用了哪个模板以及获得的结果。
对于最火的上传,它没有在<CreateInPlace>true</CreateInPlace>
中添加MyTemplate.vstemplate
,这是必需的。
在第二篇文章中,它在zip
文件中添加了其他文件夹,即使在VS中也不会创建模板项目。
请按照以下步骤操作:
CCCCore2Angular6Template.zip
下的Visual Studio 2017\Templates\ProjectTemplates
CCCCore2Angular6Template
Visual Studio 2017\Templates\ProjectTemplates