Each MSBuild item (almost every one) can have a Condition associated with it. I would suggest that you edit the project file (which is the MSBuild file itself) and place all the SQL server links in an ItemGroup on which there is a condition, for example:
<ItemGroup Condition="'$(SqlServerTargetEdition)'=='2005'"> <Reference Include="..."/> </ItemGroup>
And another ItemGroup for Sql 2008 server:
<ItemGroup Condition="'$(SqlServerTargetEdition)'=='2008'"> <Reference Include="..."/> </ItemGroup>
You must specify a default value for the SqlServerTargetEdition property before declaring these elements. Then, on the command line, you can override this value with the / p switch when you call msbuild.exe .
Said Ibrahim Hashimi
My book: Inside Microsoft Build Engine: Using MSBuild and Team Foundation Build
Sayed Ibrahim Hashimi
source share