0
votes

I created a console application and added Newtonsoft.json as reference for test.

After following the steps, I published the application (netcoreapp2.0) to ubuntu.16.04-x64 version and deployed it to a Ubuntu(16.04) machine, when I run the console application, it always shows below error even the package exists in /usr/local/share/dotnet/store

An assembly specified in the application dependencies manifest (RuntimePackageConsole.deps.json) was not found: package: 'Newtonsoft.Json', version: '11.0.1' path: 'lib/netstandard2.0/Newtonsoft.Json.dll' This assembly was expected to be in the local runtime store as the application was published using the following target manifest files: artifact.xml

After I changed the path of Newtonsoft.Json.dll in dependency json file to absolute path, then it works.

Anybody had the same issue on Linux? Or how can I find out the reason, why can't application load the package by relative path in dependency json file?

1
Which publish steps did you follow? Was a NewtonsoftJson.dll added to the publish output (dotnet publish)? - Martin Ullrich
I published with a manifest. No, the publish output does not contain the Newtonsoft.json.dll, application should load it from runtime package store while running. - zgu

1 Answers

1
votes

It looks like you are targeting a manifest when you publish your code.

Starting with .NET Core 2.0, it's possible to package and deploy apps against a known set of packages that exist in the target environment. The benefits are faster deployments, lower disk space use, and improved startup performance in some cases.

This feature is implemented as a runtime package store, which is a directory on disk where packages are stored (typically at /usr/local/share/dotnet/store on macOS/Linux and C:/Program Files/dotnet/store on Windows). Under this directory, there are subdirectories for architectures and target frameworks. The file layout is similar to the way that NuGet assets are laid out on disk:

A target manifest file lists the packages in the runtime package store. Developers can target this manifest when publishing their app. The target manifest is typically provided by the owner of the targeted production environment.

https://docs.microsoft.com/en-us/dotnet/core/deploying/runtime-store

So you may want to take a look at your environment and ensure that your package stores do in fact have the required libraries, or that you publish without a manifest.