|
How do I pass the value of a property from one project to another? I have the following target defined within my project file: Main.csproj: <Target Name="AfterBuild"> <Message Text="AssemblyMajorVersion = $(AssemblyMajorVersion)"/> <Message Text="AssemblyMinorVersion = $(AssemblyMinorVersion)"/> <Message Text="MaxAssemblyVersion = $(MaxAssemblyVersion)"/> <Message Text="MaxAssemblyFileVersion = $(MaxAssemblyFileVersion)"/> <CreateProperty Value="$(MaxAssemblyVersion)"> <Output TaskParameter="Value" PropertyName="MaxAssemblyVersion" /> </CreateProperty> </Target> I have an MSBuild proj file that neds to use MaxAssemblyName in order to do a ClickOnce publish: Publish.proj: <?xml version="1.0" encoding="utf-8"?> <Project InitialTargets="GetDefaults;SetDefaults;DoBuild;GetAssemblyVersion" DefaultTargets="DoPublish" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> <Target Name="DoBuild" > <Message Text="Building occ600 in $(BuildMode) mode"/> <Exec Command="CALL vsvars32.bat" Condition="'$(DevEnvDir)' == ''" WorkingDirectory="$(VS90COMNTOOLS)" /> <MSBuild Projects="..\..\Source\OCC600.sln" Targets="Clean;Build" Properties="Configuration=$(BuildMode)" /> <Message Text="Built occ600 version = $(MaxAssemblyVersion) in $(BuildMode) mode"/> </Target> <Target Name="DoPublish"> <Message Text="Publising occ600 Version $(MaxAssemblyVersion)"/> <MSBuild Projects="..\..\Source\Infrastructure\Infrastructure.Shell\Infrastructure.Shell.csproj" Targets="Publish" Properties="ApplicationVersion=$(MaxAssemblyVersion);Configuration=$(BuildMode);PublishDir=$(ClickOnceInstallDirectory)" /> </Target> <Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/> <Import Project="..\..\Source\Infrastructure\Infrastructure.Shell\Main.csproj"/> </Project> But when control returns to this target, MaxAssemblyVersion is always empty. How do I pass MaxAssemblyVersion from Main.csproj to Publish.proj? TIA, Klaus
- Changed TypeWesley YaoMSFT, ModeratorMonday, September 07, 2009 4:25 AMsolved by environment variable
-
|