Suppose a script reads in several properties we want to use on the various projects. In this example we will hardcode them in a PropertyGroup node as follows:
1 2 3 4 | < PropertyGroup Label = "Build options" Condition = "'$(GenerateSerializationAssemblies)' == ''" > < GenerateSerializationAssemblies >Auto</ GenerateSerializationAssemblies > <!-- Auto|On|Off --> < Configuration >Release</ Configuration > </ PropertyGroup > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | < ItemGroup > < ProjectsToBuild Include = "$(SourceFolder)\$(DemoWeb)\$(DemoWeb).csproj" > < Targets >Package</ Targets > < Properties >BasePackagePath=.\$(WSPOutputFolder)\;IsPackaging=True;Configuration=$(Configuration);GenerateSerializationAssemblies=$(GenerateSerializationAssemblies)</ Properties > </ ProjectsToBuild > < ProjectsToBuild Include = "$(SourceFolder)\$(DemoConfiguration)\$(DemoConfiguration).csproj" > < Targets >Package</ Targets > < Properties >BasePackagePath=.\$(WSPOutputFolder)\;IsPackaging=True;Configuration=$(Configuration);GenerateSerializationAssemblies=Off</ Properties > </ ProjectsToBuild > < ProjectsToBuild Include = "$(SourceFolder)\$(DemoBusinessData)\$(DemoBusinessData).csproj" > < Targets >Package</ Targets > < Properties >BasePackagePath=.\$(WSPOutputFolder)\;IsPackaging=True;Configuration=$(Configuration);GenerateSerializationAssemblies=Off</ Properties > </ ProjectsToBuild > < ProjectsToBuild Include = "$(WCFSourceFolder)\$(DemoSvc)\$(DemoSvc).csproj" > < Targets >ResolveReferences;_CopyWebApplication</ Targets > < Properties >WebProjectOutputDir=$(WCFOutputFolder)\;OutDir=$(WCFOutputFolder)\bin\;Configuration=$(Configuration)</ Properties > </ ProjectsToBuild > </ ItemGroup > |
1 2 3 4 5 6 7 8 9 10 | < Target Name = "Compile" DependsOnTargets = "Clean" > <!-- ... Other tasks ... --> < MSBuild Projects = "@(ProjectsToBuild)" > < Output ItemName = "BuildOutput" TaskParameter = "TargetOutputs" /> </ MSBuild > < Message Text = "!%0D%0A@(BuildOutput)" /> <!-- ... Other tasks ... --> </ Target > |
I have not found this documented previously, but it works for me. I hope it will help someone else.
No comments:
Post a Comment