0

I have a MSBuild proj file like below:

In PreBuild.proj, I create a dynamic property with UsingTask:

<GetBuildNumber Condition="'$(BuildNumber)' == ''" MajorVersion="2" MinorVersion="0" StartYear="2012">
    <Output TaskParameter="BuildNumber" PropertyName="BuildNumber" />
</GetBuildNumber>

Now I want to pass this $(BuildNumber) to the PostBuild.proj.

How to do that?

Ilya Kozhevnikov
  • 10,242
  • 4
  • 40
  • 70
smwikipedia
  • 61,609
  • 92
  • 309
  • 482

1 Answers1

0

Depends on how they are linked. Hopefully you have an overall orchestrating project that imports all you pre and post dependencies a la your standard Visual Studio-generated .csproj that imports all the neccesary .targets and .props and is the main entry point for MSBuild since you'd never call the .targets directly, they only make sense as part of a bigger build file. In case of such well-designed project file you just use a property, otherwise you can try Outputs or Returns or worst case scenario WriteLinesToFile & ReadLinesFromFile.

Community
  • 1
  • 1
Ilya Kozhevnikov
  • 10,242
  • 4
  • 40
  • 70