とプロパティ値を上書き:DefaultVariables.msbuildMSBuildのは私だけPropertyGroupが含まれているのMSBuildスクリプトを持っているインポート
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- default values if nothing is set in Main.proj -->
<PropertyGroup>
<ProjectName Condition="'$(PublishService)'==''">DefaultService</ProjectName>
</PropertyGroup>
</Project>
PublishServiceを変更することができ、環境に依存します。 は私も持っているとVariables.msbuildは、サービス名を除いて、上記のスクリプトと同じです:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- default values if nothing is set in Main.proj -->
<PropertyGroup>
<ProjectName Condition="'$(PublishService)'==''">ErpService</ProjectName>
</PropertyGroup>
</Project
私の主なビルドスクリプト:BuildMsi.msbuild DefaultVariables.msbuildをインポートするとMSIの呼び出し対象CreateEnvironmentSpecificInstallerを持っています。 MSBuildのは
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="CreateInstaller">
<PropertyGroup>
<BaseDir Condition="$(BaseDir)==''">$(MSBuildProjectDirectory)</BaseDir>
</PropertyGroup>
<Import Project="DefaultVariables.msbuild" />
<!-- Something else -->
<Target Name="CreateEnvironmentSpecificInstaller" DependsOnTargets="$(SpecificBuildSteps)">
<MSBuild Projects="$(RedistDir)\Framework\Msi.msbuild" Targets="CreateBatchScripts" StopOnFirstFailure="true" Properties="Configuration=$(Configuration)" RebaseOutputs="true" />
</Target>
<Target Name="CreateInstaller" DependsOnTargets="PrintVersion;$(GenericBuildSteps)">
<MSBuild Condition=" '$(EnvironmentName)' == '**AllEnvironments**' " Projects="$(BaseDir)\$(BtsDeploymentFrameworkDir)\BuildMsi.msbuild" Targets="CreateEnvironmentSpecificInstaller" StopOnFirstFailure="true"
Properties="Configuration=$(Configuration);" RebaseOutputs="true" />
<CallTarget Targets="RemoveGeneratedEnvironmentSettings" />
</Target>
</Project>
Msi.msbuildスクリプトでは、私はVariables.msbuildスクリプトへのインポートを追加しますが、この後のPublishServiceはまだDefaultServiceです:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="CreateInstaller">
<Import Project="Variables.msbuild" />
<Target Name="CreateBatchScripts">
<Message Text="PublishService = $(PublishService)" />
</Target>
</Project>
実行時にこのプロパティ値を上書きする方法はありますか?