0

We have a WPF application that we are trying to publish as a single file.

I am running the command:

dotnet publish .\{path_to_projectA_csproj_file}.csproj -c Release --self-contained -p:PublishSingleFile=true -p:PublishReadyToRun=true -p:IncludeNativeLibrariesForSelfExtract=true --nologo -v q --property WarningLevel=0 /clp:ErrorsOnly

It generates the following files: published files

Problem is, when trying to run it in test environment, it does not find a third party .dll. Error from event log:

enter image description here

The third party .dll is referenced in ProjectB that is referenced by ProjectA that I am trying to publish.

Third party .dll reference in ProjectB .csproj:

projectBcsproj

I tried:

  • using the "-p:IncludeAllContentForSelfExtract=true" publish parameter - did not help
  • setting build action to Content - did not help
  • settings .csproj parameters CopyToOutputDirectory and CopyToPublishDirectory to PreserveNewest - did not help

tl;dr how to include third party libraries into .exe file when publishing a dotnet application as single file?

1
  • Maybe you'll find something worth a read in the docs Single-file deployment. Commented Feb 2 at 18:33

1 Answer 1

0

The third-party .dll was compiled as 32-bit, so I had to add a "win-x86" runtime identifier to the project.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.