admin管理员组

文章数量:1123011

I've written custom msbuild content to run a T4 generation task. It's half-working; the biggest problem currently is that Visual Studio fails to invoke msbuild when dependent inputs change. This occurs both in the presence and absence of AccelerateBuildsInVisualStudio.

Rebuild always works.

I tried to follow these guides, to no avail:

  • Item metadata in task batching
  • Build incrementally

After the first build (or any rebuild) and one of the .tt files is modified, the only output on subsequent build is

========== Build: 0 succeeded, 0 failed, 2 up-to-date, 0 skipped ==========

The msbuild content responsible for the custom item group and task is

  <ItemGroup>
    <ProjectReference Include="..\Common\Common.csproj">
      <Private>False</Private>
      <ReferenceOutputAssembly>True</ReferenceOutputAssembly>
    </ProjectReference>

    <CppTemplates Include="Cpp\*.tt">
      <Ext>h</Ext>  
    </CppTemplates>
    <!-- will add other languages -->
    <Templates Include="@(CppTemplates)" />
  </ItemGroup>

  <Target Name="PreBuild" BeforeTargets="PreBuildEvent" Inputs="@(Templates)"
          Outputs="@(Templates->'$(T4OutputDir)\%(Filename).%(Ext)')">
    <MakeDir Directories="$(T4OutputDir)" />
    <Exec Command="$(T4Command) -out @(Templates->'$(T4OutputDir)\%(Filename).%(Ext)') %(Templates.Identity)" />
  </Target>

本文标签: Custom msbuild target doesn39t detect file changesStack Overflow