0

In our target DestinationFiles we wish to set path to contain the version number of the project file we use to build. Is there a variable we can use to get that value?

< Target Name="CopyOutput">
  <ItemGroup>
     <PackagedFiles Include="blah blah"/>
  </ItemGroup>
  <Copy SourceFiles="@(PackagedFiles)" 
        DestinationFiles="@(PackagedFiles->'\\Blah\SOME_VERSION_NUMBER_FROM_BUILD\$(Configuration)\%(RecursiveDir)%(Filename)%(Extension)')"/>
</Target>
Ian Vink
  • 66,960
  • 104
  • 341
  • 555

1 Answers1

0

Sure just use $(VARNAME) and call msbuild with /p:VARNAME=XXXX

For more details regarding using enviornment vars with msbuild, you can have a look at https://sbarnea.com/articles/easy-windows-build-versioning/

sorin
  • 161,544
  • 178
  • 535
  • 806