Open ymh199478 opened 4 years ago
cc: @ericstj I wonder why the "runtime agnostic" is not finding the file in the package, but the -rid specific is working just fine. Do you have any ideas?
When specifying runtime the SDK doesn't write things to RID-specific folders, it flattens everything to a single directory. This sounds like an SDK issue with deps file or publish. Transferring.
I tried your repro by copy/pasting the files in stack overflow to the directory structure you mentioned and couldn't get it to reproduce. Would you be able to provide an isolated repro of this?
This problem can occur in .net core 2.0, 2.1, 2.2.
isolated repro:
git clone https://github.com/yb199478/dotnet-publish-reproduce.git
cd dotnet-publish-reproduce
dotnet publish -c Release --self-contained false
cd src/Reproduce.CLI/bin/Release/netcoreapp2.0/publish
dotnet Reproduce.CLI.dll
dotnet --info:
.NET Core SDK (reflecting any global.json):
Version: 3.0.100
Commit: 04339c3a26
Runtime Environment:
OS Name: Windows
OS Version: 6.1.7601
OS Platform: Windows
RID: win7-x64
Base Path: C:\Program Files\dotnet\sdk\3.0.100\
Host (useful for support):
Version: 3.0.0
Commit: 95a0a61858
.NET Core SDKs installed:
2.0.0 [C:\Program Files\dotnet\sdk]
2.0.2 [C:\Program Files\dotnet\sdk]
2.1.4 [C:\Program Files\dotnet\sdk]
2.1.104 [C:\Program Files\dotnet\sdk]
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.504 [C:\Program Files\dotnet\sdk]
2.1.505 [C:\Program Files\dotnet\sdk]
2.1.700 [C:\Program Files\dotnet\sdk]
2.1.801 [C:\Program Files\dotnet\sdk]
2.2.300 [C:\Program Files\dotnet\sdk]
2.2.401 [C:\Program Files\dotnet\sdk]
3.0.100 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNe
tCore.All]
Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNe
tCore.All]
Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspN
etCore.All]
Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspN
etCore.All]
Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspN
etCore.All]
Microsoft.AspNetCore.All 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNe
tCore.All]
Microsoft.AspNetCore.All 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNe
tCore.All]
Microsoft.AspNetCore.All 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNe
tCore.All]
Microsoft.AspNetCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNe
tCore.App]
Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNe
tCore.App]
Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspN
etCore.App]
Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspN
etCore.App]
Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspN
etCore.App]
Microsoft.AspNetCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNe
tCore.App]
Microsoft.AspNetCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNe
tCore.App]
Microsoft.AspNetCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNe
tCore.App]
Microsoft.AspNetCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNe
tCore.App]
Microsoft.NETCore.App 2.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.
App]
Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.
App]
Microsoft.NETCore.App 2.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.
App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.
App]
Microsoft.NETCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.
App]
Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.
App]
Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore
.App]
Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore
.App]
Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore
.App]
Microsoft.NETCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.
App]
Microsoft.NETCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.
App]
Microsoft.NETCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.
App]
Microsoft.NETCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.
App]
Microsoft.WindowsDesktop.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.W
indowsDesktop.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
thanks
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'
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'
I get the same with a project targetting netcoreapp3.1, and there's no reference to CodePages anywhere in my repository.
That said, I've been doing a separate dotnet build
step, then dotnet publish
with --no-build
. If I just run publish and let it build in the same command, then the problem goes away.
Also to add, build and then publish with no-build works running the published output on linux, but not on Windows.
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.
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 usingdotnet publish
, But there was an error during execution:Compile project
Execute program
bin\Release\netcoreapp2.0\publish
Prompt error:
But, if I specify a
--runtime
, then no error will occur:Compile project
Execute program
bin\Release\netcoreapp2.0\win-x64\publish
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