First of all, I would recommend using msbuild scripts to create your solutions instead of directly creating a sln file using the command line. For instance. use something like this:
msbuild SolutionName.Build.proj
and inside this Solution1.Build.proj you can put everything as simple as
<Project ToolsVersion="4.0" DefaultTargets="BuildMe" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Target Name="BuildMe"> <MSBuild Projects="SolutionName.sln" Properties="property1=value1;property2=value2;"/> </Target> </Project>
After this step, which adds flexibility to your build process, you can begin to use the additional property metadata for the MSBuild task.
Then you can use the <Import construct to store the list of common properties in a separate file and item metadata to pass property values:
<Project ToolsVersion="4.0" DefaultTargets="BuildMe" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="MySharedProperies.props" /> <ItemGroup> <ProjectToBuild Include="SolutionName.sln"> <AdditionalProperties>SomeProjectSpecificProperty</AdditionalProperties> </ProjectToBuild> </ItemGroup> <Target Name="BuildMe"> <MSBuild Projects="@(ProjectToBuild)" Properties="@(MySharedProperies)"/> </Target> </Project>
You can check this post for more information on properties and additional property metadata or this original MSDN link (highlight the "Metadata Properties" section)
This is the basic idea of ββhow to do this, if you have any questions - feel free to ask.
source share