VS: Provide Option for <HintPath> Only References
On a current project I was using Xceed.Wpf.Toolkit and ZedGraph. Both of these are C# Assemblies that have UI controls in them. The standard set_property
as shown below for adding references was used.
set_property(TARGET ${PROJECT_NAME}
PROPERTY
VS_DOTNET_REFERENCE_ZedGraph
"${CMAKE_SOURCE_DIR}/externals/packages/ZedGraph.5.1.7/lib/net35-Client/ZedGraph.dll"
)
The resulting reference entry in the corresponding *.csproj file was as shown below:
<Reference Include="Xceed.Wpf.Toolkit">
<CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
<Private>False</Private>
<HintPath>C:\Local_Path\packages\Extended.Wpf.Toolkit.3.5.0\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
</Reference>
This built without error but the UI Controls would not display. I suspected the Reference as a problem so via Visual Studio I removed the references as added by CMake and then manually added them using Visual Studio. Then I rebuilt and the UI controls appeared and functioned as expected. I then inspected the *.csproj to see what had changed and the reference entry now looked like what you see below:
<Reference Include="Xceed.Wpf.Toolkit">
<HintPath>C:\Local_Path\packages\Extended.Wpf.Toolkit.3.5.0\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
</Reference>
To achieve this I need a TARGET Property as shown below that would achieve the "correct" Reference entry for 1 or more named references.
set_property(TARGET ${PROJECT_NAME}
PROPERTY
VS_DOTNET_REFERENCES_HINT_PATH_ONLY
"Xceed.Wpf.Toolkit;ZedGraph"
)