Closed woodne closed 4 years ago
You are passing the deps.json of the library to the host and it will potentially use that deps.json as well. Which leads to your problem. Libraries in general are not runnable and in particular, netstandard2.0 is not runnable.
This is expected with the current architecture of .NET Core. I would maybe suggest targeting netcoreapp2.1 in your libraries if you want to use their deps.json.
I have a situation in which I have a host application, that hosts a variety of microservices, which are created as class libraries. In my config file, I specify my unity configuration which registers the types for each service in the container, then during startup, the application host does all the startup.
This is an application originally developed against .net framework and WebApi 2, but I have ported it to .net core and ASP.NET Core MVC and it uses the System.Runtime.Caching assembly.
When I run the host application as below
I am getting the following exception:
The (abbreviated) deps.json for the class library looks like:
and the netcoreapp looks like:
If I change the class library to target netcoreapp2.1 instead of netstandard2.0, it works fine, and without the
--additional-deps
flag, it seems like it is using the netcoreapp2.0 runtime version of the System.Runtime.Caching assembly, and it works too.Steps to reproduce
clone https://github.com/woodne/host-app-caching
Execute
./repro.sh
See that it throws
Expected behavior
Shouldn't throw? I would expect that it uses the .netcore runtime instead of .netstandard
Actual behavior
Throws
Environment data
dotnet --info
output: