file(GET_RUNTIME_DEPENDENCIES): Does not pick up managed runtime dependencies
When calling file(GET_RUNTIME_DEPENDENCIES)
or using an adequate install
command, not all dependencies are picked up for C# or C++/CLI assemblies. This does only affect managed dependencies. At least for mixed-mode assemblies, unmanaged dependencies are properly returned by dumpbin
. However, purely managed dependencies are not returned. Instead of using dumpbin
, they can be acquired using ildasm
and parsing the .assembly extern
sections. To get all dependencies for a mixed-mode assembly, both steps are required.
Unfortunately, I do not feel comfortable enough with the internals of .NET assembly resolution to provide a MR to address this issue. But I think it would be worth mentioning this behavior in the docs. For example, if one tries to perform install(TARGETS ... RUNTIME_DEPENDENCIES)
on a C# target, no dependencies are resolved at all, which is not expected.
An additional benefit of supporting this in the future would be to have an elegant solution for installing for NuGet packages (VS_PACKAGE_REFERENCES
), which is currently not possible.