Peter
Peter

Reputation: 14128

Is it possible to pass properties between MSBuild projects?

Is it possible to pass a property from one msbuild project to another? So in one .proj file there is a property with PropertyName="Foo" (for example). Can we access this from another .proj file i.e. use "$(Foo)" in the other msbuild project?

Upvotes: 5

Views: 2206

Answers (3)

Wesam Abdallah
Wesam Abdallah

Reputation: 1180

Try using the $(MSBuildArguments) variable. I know that it works in TFS but I am not sure if it works in command prompt.

Upvotes: 0

Julien Hoarau
Julien Hoarau

Reputation: 50000

By using the Import element in the file where you want to use the property.

<Import Project="ProjectPath"/>

Upvotes: 4

Cristian Libardo
Cristian Libardo

Reputation: 9258

One way to do it is to pass properties as you call the next script, e.g.

<MSBuild Projects="another.proj" Properties="PropertyName=$(Foo)" />

Upvotes: 6

Related Questions