Closed gleen-code closed 5 months ago
A bit of background:
dotnet publish
. More on that behavior here and here. The best way we've found to get the DLL into the output directory is to edit the .csproj file and add an msbuild copy step:
<ItemGroup>
<PackageReference Include="Microsoft.O365.Security.Native.ETW" Version="4.3.2">
<GeneratePathProperty>true</GeneratePathProperty>
</PackageReference>
</ItemGroup>
<Target Name="CopyFiles" AfterTargets="Build">
<ItemGroup>
<File Include="$(PkgMicrosoft_O365_Security_Native_ETW)\runtimes\win-x64\native\Ijwhost.dll"></File>
</ItemGroup>
<Copy SourceFiles="@(File)" DestinationFolder="$(OutDir)"></Copy>
</Target>
Want to give this a try and let us know whether it works?
Thank you very much, @swannman. That's works and makes sense.
I think you should document this, I've found more people with the same issue, and it's not very intuitive to solve.
Hi,
I am using C# with the .NET 6.0 framework and trying to use the NuGet Microsoft.O365.Security.Native.ETW package (https://www.nuget.org/packages/Microsoft.O365.Security.Native.ETW/).
Although all the dependencies are resolved and the library is installed correctly, at run it says that it cannot load the library. This is the exception:
Inspecting the library dependencies, in the folder where it has been compiled, I can see that
ijwhost.dll
is not found.Although the dependency is located in the same directory, in the following path:
runtimes\win-x64\native\Ijwhost.dll
This is the directory
bin\Debug\net6.0-windows7.0
structure:Microsoft.O365.Security.Native.ETW.dll
runtimes\win-x64\native
Ijwhost.dll
If I change the .NET framework version to 5.0, everything works fine. Above 6.0, it does not work with any version. Any ideas?