I have a VisualC++ project as a vcxproj and I need to have one of the ProjectDependency elements conditionally included.
I've tried a few different ways and nothing seems to be working.
In my fubar.vcxproj I have the following:
<ItemGroup Condition="'$(BuildRaster)'=='True'">
<ProjectReference Include="Raster.vcxproj" Condition="'$(BuildRaster)'=='True'">
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
<Private>false</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
</ProjectReference>
</ItemGroup>
In the collector .proj file that I use I have this
<ItemGroup>
<FUBARProject Include="$(Proj_Root)\fubar.vcxproj"/>
</ItemGroup>
<Target Name="BuildWithRaster">
<MSBuild Projects="@(FUBARProject)" Properties="ExportIncludes=true;Constants=IncludeRaster;BuildRaster=True"/>
</Target>
<Target Name="BuildWithoutRaster">
<MSBuild Projects="@(FUBARProject)" Properties="ExportIncludes=true;Constants=ExcludeRaster;BuildRaster=False"/>
</Target>
There's actually over a hundred dependent projects so this is only a snippet of the stubbed out version. A conditional ProjectReference seems to work for a csproj but not for a vcxproj. I've tried putting the conditional on the ProjectReference and also on the ItemGroup element; neither made a difference.