VS2017新的csproj类型不从VSTemplate输出文件

问题描述 投票:2回答:1

如果我在VS2017中基于新的csproj格式创建一个新库,例如

<Project Sdk="Microsoft.NET.Sdk">

当我创建VSTemplate,然后使用模板,它创建项目,但没有任何文件被复制,即使它们位于模板文件夹中。

我发现的一个例外是,如果任何文件是嵌入式资源,因此标记为这样

<ItemGroup>
  <EmbeddedResource Include="App.xaml">       
     <Generator>MSBuild:UpdateDesignTimeXaml</Generator>     
  </EmbeddedResource>   
</ItemGroup>

该文件将输出到项目中。但即使App.xaml.cs也没有通过。

我使用旧的csproj格式创建的任何VSTemplate都按预期工作。

vsix
1个回答
2
投票

我能够通过将<CreateInPlace>true</CreateInPlace>添加到我的<TemplateData>中的.vstemplate部分来解决这个问题。例如:

<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Project">
  <TemplateData>
    <Name>Service Template</Name>
    <Description></Description>
    <ProjectType>CSharp</ProjectType>
    <ProjectSubType>
    </ProjectSubType>
    <SortOrder>1000</SortOrder>
    <CreateNewFolder>false</CreateNewFolder>
    <DefaultName>NewService</DefaultName>
    <ProvideDefaultName>true</ProvideDefaultName>
    <LocationField>Enabled</LocationField>
    <EnableLocationBrowseButton>true</EnableLocationBrowseButton>
    <CreateInPlace>true</CreateInPlace>
  </TemplateData>

从您在评论中发布的first issue找到的解决方案。

© www.soinside.com 2019 - 2024. All rights reserved.