I use SvnInfo task in MSBuild script:
<SvnInfo LocalPath="$(Sources)">
<Output TaskParameter="Revision" PropertyName="Revision" />
</SvnInfo>
$(Sources)
contains source files only.
Obviously SvnInfo
depends on files in $(Sources)
.
Target then uses info to generate output file with revision number.
In fact I want to run SvnInfo when revision number is changed, but not to run Target (use incremental build) when Revision number is the same as previous run.
How to specify correctly input in target (attribute Inputs
in Target
tag, which contains call of SvnInfo
task)?
I made it in the following way:
<ItemGroup>
<Target1Inputs Include="$(Sources)\**" />
</ItemGroup>
<Target Name="Target1" Inputs="@(Target1Inputs)" Outputs="...">
...
<!-- SvnInfo call here -->
<!-- File with revision number is created here -->
</Target>
It seems to me its workaround, because ideally I sho开发者_开发问答uld know which files SvnInfo
depends on without guessing. Is it possible to obtain such info?
I am also not aware whether .svn
folders are modified or not.
Basically in this way:
<PropertyGroup>
<ExcludePdbs>$(YourOutputPath)\**\*.pdb</ExcludePdbs>
<ExcludeTmp>$(YourOutputPath)\**\*tmp*</ExcludeTmp>
</PropertyGroup>
<!-- Prepare set of files -->
<ItemGroup>
<Files Include="$(FilesToIncludeFolder)\**\*.*"
Exclude="$(ExcludePdbs);$(ExcludeTmp);$(ExcludeOtherFiles);"/>
</ItemGroup>
<!-- Pass into the target -->
<Target Name="Target1" Inputs="@(Files)" Outputs="..." />
EDIT: The question was updated so here is my update as well
Supposing you can handle revision changed state, you can add Condition
to a Target
and run it depends on property $(RevisionWasChanged)
.
<Target Condition="$(RevisionWasChanged)=='True'"` />
Also to control build script execution flow you can use <Choose>
feature:
<Choose>
<When Condition="$(RevisionWasChanged)=='True'">
</When>
<Otherwise>
</Otherwise>
</Choose>
Let me know whether it works for you.
精彩评论