-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No Ijwhost.dll when referencing C++/CLR NuGet package from .NET 6 C# app #24310
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov Issue DetailsIt'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 If I reference the C++/CLR as a NuGet What's the expected way to get this working? Is there an option I can specify in the .nuspec file or 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
|
The Also: moving this to the SDK repo where it belongs. |
I’d have to think about the right place to put it in the NuGet package so the loader finds it correctly. Then we’d need to figure out how the C++/CLI targets copy it to the output directory and either update those targets to put it in the right spot in the package or add a target here that puts it in the right spot. |
Well is there any possibility that two NuGet packages use different versions of ijwhost.dll? |
@jkoritzinsky any recommendations on how to include the Ijwhost.dll in a NuGet package? Searching GitHub gives a few approaches:
You don't want the dll to be referenced by the project (so not Anyway, if I do i.e. nowhere near the assembly where it needs to be. |
I had already part of the solution, because I previously needed to include another native DLL. so I had found and used the following solution on Stack Overflow (to include a target file with the NuGet package, which instruct VS to include the native DLLs into customer's project as to be copied to output dir) : ... then it was just a matter of adding the self-name-mocking "It Just Work" DLL to the NuGet list of files in the .nuspec file, under "build" subdirectory :
|
But I admit my solution seems to me a workaround and I guess the Visual Studio teams should work to address this issue... ? |
It seems my solution is not working for F# interactive, still searching a new solution! :| |
That works for Microsoft.NET.Sdk ... but not for Microsoft.NET.Sdk.Web ... any idea why, or how to fix? |
It'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 aFailed 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.The text was updated successfully, but these errors were encountered: