I'm attempting to setup a .csproj file to have a conditional item group which will remove all of the elements in the <ProjectReference> item group.
For example:
<ItemGroup> <ProjectReference Include="..\..\..\..\Projects\Registrar\Ucsb.Sa.Registrar.Common\Ucsb.Sa.Registrar.Common\Ucsb.Sa.Registrar.Common.csproj"> <Project>{1EDDDE57-0181-41B4-B2AE-FB76450F85C8}</Project> <Name>Ucsb.Sa.Registrar.Common</Name> </ProjectReference> </ItemGroup> <ItemGroup Condition="$(OnBuildServer) == 'true'"> <ProjectReference Remove="*" /> </ItemGroup> <ItemGroup Condition="$(OnBuildServer) == 'true'"> <Reference Include="Ucsb.Sa.Registrar.Common"> <SpecificVersion>False</SpecificVersion> <HintPath>$(RegCommonDll)</HintPath> </Reference> </ItemGroup> But, when I load the project into VS 2008, I get the error message 'The attribute "Remove" in element <ProjectReference> is unrecognized". The odd thing is that the Remove attribute is in the schema (C:\Program Files\Microsoft Visual Studio 9.0\Xml\Schemas\1033\MSBuild\Microsoft.Build.Core.xsd). There is MSDN documentation on it (http://msdn.microsoft.com/en-us/library/bb651786.aspx). And, there is a comment about it at the bottom of the MSDN article titled "MSBuild Items".
The .csproj file seems to be pointing to .NET 3.5; but I am unable to verify if that version of msbuild is being used to load the project (does anyone know how to do that?)
First line of .csproj file:
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> PS. I got the idea to use the conditionals from Build with msbuild and dynamically set project references