获取msbuild更改的文件列表

时间:2016-10-14 13:58:39

标签: c# visual-studio-2013 msbuild

我正在使用MSBuild和msbuild属性文件构建一个.net项目,如下所示:

<Project DefaultTargets="Compile" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
    <BuildArtifactsDir Include="$(WORKSPACE)\artifacts" />
    <FilesWritten Include="@(EndFiles)" />
    <BuildArtifactsREsult Include="F:\BuildArtifactsREsult\$(JenkinsArtifactLocation)" />
    <SolutionFile Include="$(WORKSPACE)\$(SourceFolder).sln" />
</ItemGroup>

<PropertyGroup>
    <SourceFolder Condition=" '$(SourceFolder)' == '' ">$(JOB_NAME)</SourceFolder>
    <JenkinsArtifactLocation Condition=" '$(JenkinsArtifactLocation)' == '' ">$(JOB_NAME)</JenkinsArtifactLocation>
    <Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
    <BuildPlatform Condition=" '$(BuildPlatform)' == '' ">Any CPU</BuildPlatform>
</PropertyGroup>

<Target Name="Compile" DependsOnTargets="Init">
    <MSBuild Projects="@(SolutionFile)" Targets="Build"
            Properties="OutDir=%(BuildArtifactsDir.FullPath);Configuration=$(Configuration);Platform=$(BuildPlatform)" />
    <ItemGroup>
        <FilesWritten Include="@(EndFiles)" />
        <FilesWritten Remove="@(StartFiles)"/>
    </ItemGroup>        
            <Message Text="FileWrites: @(FileWrites)" Importance="high"/>
</Target>


<Target Name="Init" DependsOnTargets="Clean">
    <MakeDir Directories="@(BuildArtifactsDir)" />
    <MakeDir Directories="@(BuildArtifactsREsult)" Condition="!Exists('$(BuildArtifactsREsult)')"/>
</Target>

<Target Name="Clean">
    <RemoveDir Directories="@(BuildArtifactsDir)" />
</Target>

我需要获取构建后更改的文件列表。 看起来我应该更改A,B类,所以A.dll和B.dll被重建了,我输入的内容就像“Changed files:A.dll,B.ll”。 如果我可以将它输出到文件,那将是非常好的。 我试图按照this post的说明操作,但它对我不起作用,我收到错误“

  

F:\ msbuild \ test.msbuild(5,17):错误MSB4066:属性“删除”   元素中的元素无法识别。“

如果我删除此属性,我将获得一个空输出。

0 个答案:

没有答案