Cannot find dependencies when executing an assembly published by dotnet publish
See original GitHub issueThis 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?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:6 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had the same problem:
dotnet Reproduce.CLI.dll
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.