You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dotnet publish is not producing dll capable of running. I get a:
Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. The system cannot find the file specified.
which I don't get when running the app with a dotnet run at the main project. I would expect the exact same behavior, but probably something is missing when publishing causing this runtime exception despite the assembly being among the dotnet publish output files?
$ dotnet --version
5.0.401
To Reproduce
I've got a solution with projects and some nuget dependencies (see tree in additional information below). When I run it like this
dotnet run --project src/MyCompany.ItgService -c Release
it works fine.
Now, to reproduce the error at the same root level
dotnet publish -c Release -o publish (see contents with tree in additional information below).
cd publish
dotnet MyCompany.ItgServce.dll throws a FileNotFoundException of a missing file or assembly, but the assembly is there
Doing dotnet publish -r linux-x64 -c Release --self-contained true -o publish didn't make any difference either. Same exception when running from publish folder
This is not a bug. It seems it's a version conflict after all (all details explained in the stackoverflow link I referred to).
Closing. Sorry about that.
Describe the bug
dotnet publish
is not producing dll capable of running. I get a:which I don't get when running the app with a
dotnet run
at the main project. I would expect the exact same behavior, but probably something is missing when publishing causing this runtime exception despite the assembly being among thedotnet publish
output files?To Reproduce
I've got a solution with projects and some nuget dependencies (see
tree
in additional information below). When I run it like thisit works fine.
Now, to reproduce the error at the same root level
dotnet publish -c Release -o publish
(see contents withtree
in additional information below).cd publish
dotnet MyCompany.ItgServce.dll
throws aFileNotFoundException
of a missing file or assembly, but the assembly is thereThe same thing happens when running it within a docker container which image I generate by copying the contents of the publish folder using the base image
FROM mcr.microsoft.com/dotnet/aspnet:5.0
to run the appExceptions (if any)
Further technical details
This is my tree folder structure at the root repo level.
This is the
publish
output folder contents after adotnet publish -c Release -o publish
The text was updated successfully, but these errors were encountered: