How do child projects get access to properties from the parent project?


Beta 1

In Beta 1, this is not possible.

In the meantime one way to pass information onto the child projects is globally through environment variables or through the /p: switch on the msbuild command-line. These kinds of properties are available to all parent and child projects that participate in that build.

The other workaround in Beta 1 is for the parent project to use the <Exec> task to shell out to ""MSBuild.exe"" and pass in the /p: switch that way.

Beta 2 and Beyond

In Beta 2, the ""MSBuild"" task supports a parameter that will allow you to pass specific properties through to the child projects. It looks something like this:

		 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
		     ...
		     <Target Name="A" >
		         [<MSBuild] Projects="a.csproj" Properties="Property1Name=Property1Value; Property2Name=Property2Value; ...; PropertyNName=PropertyNValue" />
		     </Target>
		     ...
		 </Project>
	
Microsoft Communities