Waxren
Waxren

Reputation: 2172

How to prevent Asp.Net Core from referencing dependencies from Runtime Store

I am developing a web application using Asp.NET Core 2.1 on Visual Studio 17.7, the problem is when I publish the web app as a Framework-Dependent and I try to run the app on production machine I get this error message:

Error:
An assembly specified in the application dependencies manifest (Example.deps.json) was not found:
package: 'Cronos', version: '0.6.3'
path: 'lib/netstandard1.0/Cronos.dll'

Cronos.dll is a dependency of Hangfire library which I am using in the web app, in the Example.deps.json file I found this:

"Cronos/0.6.3": {
    "dependencies": {
      "NETStandard.Library": "2.0.3"
    },
    "runtime": {
      "lib/netstandard1.0/Cronos.dll": {
        "assemblyVersion": "0.6.3.0",
        "fileVersion": "0.6.3.0"
      }
    },
    "compile": {
      "lib/netstandard1.0/Cronos.dll": {}
    }
  },

The problem is that it's referencing the libraries in the runtime store, which will work on the developemnt machine but when I deploy to another machine the error happens.

I have tried the suggested solution in this article:

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

By setting:-

<PropertyGroup>
    <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
</PropertyGroup>

and I have also tried solutions in this github issue with no success:

https://github.com/dotnet/coreclr/issues/13542

Upvotes: 2

Views: 4202

Answers (1)

Martin Ullrich
Martin Ullrich

Reputation: 100811

When deploying a .NET Core application, only use the publish output from the bin/Release/netcoreapp*/publish or …/netcoreapp*/{RID}/publish (when using -r RID option) or call dotnet publish with an -o ../target-dir option to specify a publish target location.

The build output (bin/Release/netcoreapp*) is meant for development purposes only since the runtimeconfig.dev.json file configures .NET Core to use packages directly from your NuGet package cache which avoids copying assets during the development builds.

Upvotes: 4

Related Questions