DotNet Core console app: An assembly specified in

2020-08-26 04:47发布

问题:

Im just trying to run a DotNet Core console app on a Windows Server 2012 R2 but I keep getting this error:

Error: An assembly specified in the application dependencies manifest (Application.deps.json) was not found: package: 'Microsoft.Web.Administration', version: '11.1.0' path: 'lib/netstandard1.5/Microsoft.Web.Administration.dll'

The dll that is missing is inside the /publish folder... I used Dotnet publish with the correct Runtime Identifier (win81-x64)

I installed the Dotnet runtime 2.0.7 on the server

回答1:

Always use the publish output when deploying to a target sever.

It can be found in

bin\Release\netcoreapp2.0\win81-x64\publish

in your case (self-contained application)

or in

bin\Release\netcoreapp2.0\publish

for framework-dependent deployments.

The output in the directories above are meant to be used in development only, since they are specific to machine and user configuration built with.



回答2:

I had this issue because I deployed the wrong publish folder.

I decided to take the time a setup a publish profile.
In solution Explorer...Right Click on the Project -> Publish
or from the menu Build->Publish

.NET Core application publishing overview

Using a publish profile you can set the target location to something simple

drive:\Publish\[project]

This will save you from haveing to navigate 10 levels deep an possibly copying the wrong folder.

Deploy .NET Core apps with Visual Studio



标签: c# .net-core