Skip to content

VS: add support for .NET references with hint paths

Michael Stürmer requested to merge stuermic/cmake:dotnet_hint_references into master

In the current implementation only .NET references without paths can be added. In addition all references must be given as a single property value, i.e. as a colon separated string.

This patch enables adding .NET references like this:

set_target_properties(target PROPERTIES
  VS_DOTNET_REFERENCE_MyAssembly "C:/path/to/my/assembly.dll"
  VS_DOTNET_REFERENCE_MyNextRef "myNextRef.dll"
  )

In addition the boolean target property VS_DOTNET_REFERENCES_COPY_LOCAL is introduced which can be used to disable copying of the hint-referenced assemblies to the output directory (non-hint references are assumed to be system/.NET framework references which are never copied afaik):

set_target_properties(target PROPERTIES
  VS_DOTNET_REFERENCES_COPY_LOCAL OFF
  )

Note

While copying of referenced assemblies can be set for each assembly individually in Visual Studio, the target property toggles for all referenced assemblies. I think this makes handling things easier, otherwise we would have to introduce additional target properties like VS_DOTNET_REFERENCE_COPY_LOCAL_<refname> and set them individually.

Merge request reports