Closed Wildenhaus closed 2 years ago
Haven't really used single file publishes before.
But I think the best solution is to set IncludeAllContentForSelfExtract when doing the publish. That way the required native/mixed DLLs should be included.
You can set it in your csproj or in your PublishProfile like this:
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
Alternatively setting it in the CLI like this should also work:
dotnet publish -r win-x64 /p:PublishSingleFile=true /p:IncludeAllContentForSelfExtract=true
Let me know if this solve your problem.
That appears to have resolved the issue. Thank you!
For anyone else running into this, there's an issue tracking it here: https://github.com/dotnet/runtime/issues/45084
It seems that DirectXTexNet.cs is written in such a way that it's always expecting the DLL to be loaded from a file. However, when publishing an app and using the "Produce single file" option, it appears that
DirectXTexNetImpl.dll
is being included in the single file (Ijwhost.dll
is not).I tried to rectify this by just including the DLL in the same directory, but then something odd started happening. Consider this code:
The file exists, but
Assembly.LoadFile()
is throwing aFileNotFoundException
. Not sure what the deal is, but I thought I'd report it.