Closed yuzd closed 9 months ago
thanks for reporting. Apparently something might have changed with single files in dotnet7
I have seen a similar error. If you have any native libraries in your project, you need to take a look at the documentation on single file publishing
Try turning on IncludeNativeLibrariesForSelfExtract
either in the FolderProfile.pubxml
with:
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
OR
If you're using a build pipeline you can pass the command-line parameter:
dotnet publish -c Release -r win-arm64 -p:IncludeNativeLibrariesForSelfExtract=true
EXPLANATION: The single file packer only includes managed libraries by default. When you run a single file application it is unpacking all the files at startup. It then can't fine the native binary and throws a file not found. If you put a copy of the native dll in the same folder as the single file package it will run but then it's not a single file anymore...
I did a quick test: changed framework of ExampleAppCore
to NET7 and executed
dotnet publish -r win-x64 -p:PublishSingleFile=true --self-contained false -c Release
it worked
thanks , it worked....
when i publish to single file , Complie method get this errors: