question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot find dependencies when executing an assembly published by dotnet publish

See original GitHub issue

This is more like a question, If this is not the right place to ask questions, I apologize in advance.

I wrote a .NET Core 2.0 console application (The main code is written by .netstandard2.0). Publish using dotnet publish, But there was an error during execution:

Compile project

dotnet publish src\Bucket.CLI\Bucket.CLI.csproj -c Release --self-contained false

Execute program

  • bin\Release\netcoreapp2.0\publish
dotnet Bucket.CLI.dll

Prompt error:

Error:
  An assembly specified in the application dependencies manifest (Bucket.CLI.dep
s.json) was not found:
    package: 'System.Text.Encoding.CodePages', version: '4.5.1'
    path: 'runtimes/win/lib/netcoreapp2.0/System.Text.Encoding.CodePages.dll'

But, if I specify a --runtime, then no error will occur:

Compile project

dotnet publish src\Bucket.CLI\Bucket.CLI.csproj -c Release --self-contained false -r win-x64

Execute program

  • bin\Release\netcoreapp2.0\win-x64\publish
dotnet Bucket.CLI.dll

The program works fine.

What did i do wrong?

More info : https://stackoverflow.com/questions/58744592/cannot-find-dependencies-when-executing-an-assembly-published-by-dotnet-publish

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
gtechxcommented, Nov 14, 2019

I had the same problem:
dotnet Reproduce.CLI.dll

Error:
An assembly specified in the application dependencies manifest (Reproduce.CLI.deps.json) was not found:
    package: 'System.Text.Encoding.CodePages', version: '4.5.1'
    path: 'runtimes/win/lib/netcoreapp2.0/System.Text.Encoding.CodePages.dll'
0reactions
jimmyheaddoncommented, Aug 15, 2020

I’ve started seeing this same issue running the same for my own .NET Core 3.1 project:

dotnet publish $(ProjectPath) --configuration $(ConfigurationName) --framework netcoreapp3.1 --no-build"

Specifying --self-contained true and/or --runtime win-x64 doesn’t help in my case, unfortunately. --self-contained false also doesn’t help.

I also see an error for System.Runtime missing when running this in another environment, either by calling the .exe or the .dll output.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find dependencies when executing an assembly ...
I wrote a .NET Core 2.0 console application. Publish using dotnet publish , But there was an error during execution: ...
Read more >
dotnet publish command - .NET CLI
dotnet publish - Publishes the application and its dependencies to a folder for deployment to a hosting system.
Read more >
NET application publishing overview
Publishing an app as framework-dependent doesn't include the .NET runtime; only the app and third-party dependencies are included. The following ...
Read more >
dotnet run command - .NET CLI
The dotnet run command provides a convenient option to run your application from the source code.
Read more >
MSBuild reference for .NET SDK projects
This property is useful if you run dotnet publish on a solution file, as it allows automatic selection of projects that should be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found