No Ijwhost.dll when referencing C++/CLR NuGet package from .NET 6 C# app
See original GitHub issueIt’s possible I’m missing something, but I can’t find any clear documentation on how Ijwhost.dll is supposed to work, so I thought I’d ask here.
I have a C++/CLR project targeting .NET 5, and when this is built in Visual Studio, Ijwhost.dll ends up in the bin/ folder alongside the compiled dll. If I reference this from a .NET 6 C# project in the same solution using <ProjectReference>
, then Ijwhost.dll ends up copied into the output folder of the C# project as well, and everything works fine. (I don’t know where Visual Studio is sourcing this Ijwhost.dll from, but it clearly knows somewhere to look for it.)
If I reference the C++/CLR as a NuGet <PackageReference>
from a .NET 6 C# project in a different solution, however, then no Ijwhost.dll ends up in the output folder. Nothing in the build seems to notice that I’m referencing a C++/CLR project and locate Ijwhost.dll, and if I try running the C# app, it fails to load my C++/CLR dll with a Failed to load file or assembly
error. Manually copying an Ijwhost.dll into the output directory (eg, from the C++/CLR project in the other solution) fixes this, so it’s definitely this missing shim dll that’s the problem.
What’s the expected way to get this working? Is there an option I can specify in the .nuspec file or <PackageReference>
tag that flags the package as C++/CLR and triggers the inclusion of Ijwhost.dll? Should be bundling Ijwhost.dll into the NuGet alongside the C++/CLR library? Should I be copying it from somewhere else (where?) in the C# csproj build steps?
There are a few other Ijwhost.dll-related issues in this repo already, but as far as I can tell they all seem to be about dynamically loading a C++/CLR dll via LoadLibrary
, or about referencing the C++/CLR project as a project reference from elsewhere in the same solution – not about pulling it in as a NuGet dependency.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:10 (3 by maintainers)
Top GitHub Comments
Well is there any possibility that two NuGet packages use different versions of ijwhost.dll? I think that would lead to something like dll-hell.
That works for Microsoft.NET.Sdk … but not for Microsoft.NET.Sdk.Web … any idea why, or how to fix?