5

Trying to publish a console app to run on a linux machine, I publish like this

dotnet publish -c Release -r linux-x64

I try to run the app and get this error

An assembly specified in the application dependencies manifest (XXX.deps.json) was not found:
    package: 'runtime.linux-x64.Microsoft.NETCore.App', version: '2.2.0'
    path: 'runtimes/linux-x64/native/createdump'

I try publishing using a publish profile to a new output directory.

dotnet publish -p:PublishProfile=Properties\PublishProfiles\FolderProfile.pubxml -o:Release/OutP5

Now my output directory includes a "runtimes" directory, but no linux-x64 directory within that I tried adding a RuntimeIdentifier element in my pubxml, no change, I tried using the publish profile, but also specifying the runtime:

dotnet publish -p:PublishProfile=Properties\PublishProfiles\FolderProfile.pubxml -o:Release/OutP6 -r linux-x64

now my new output directory has no runtimes directory.

I am losing this game of whack-a-mole and I don't know why. What am I missing?

  • Try to explicitly add the self contained tag when you are publishing. It worked for me before. Use the command `dotnet publish -c Release -r linux-x64 --self-contained` and then `dotnet .dll` in the publish folder – Stelios Giakoumidis May 11 '20 at 22:04
  • Diagnostic logs for publish may provide a clue `dotnet publish -v:diag > log.txt` – Arun M May 12 '20 at 02:22
  • I tried --self-contained. It did not seem to have an effect if I leave out the -r switch, I get a "runtimes" directory in my output, but there is no "linux-x64" subdirectory like the one in my original error message. If I add the -r linux-x64, I get no "runtimes" directory. and the whack-a-mole game continues, I know I must be missing some component or there's another switch that will produce this directory – Cedar Bristol May 12 '20 at 15:07
  • 1
    The solution I found was to build on a linux machine. This works well, but I had thought that build on windows then execute on Linux, is a thing that is supposed to work. The error message I'm getting suggests that it would work if I just had that missing "runtimes" directory in my output folder – Cedar Bristol May 12 '20 at 19:50

0 Answers0