这是我的第一个.NET Core控制台应用程序,在服务器上运行该应用程序时遇到问题。该exe从我的本地计算机运行正常,但是从Windows Server 2008 r2 SP1运行时,出现以下错误:
D:\ScheduledTasks\NotificationSender>NotificationSender.exe
Error:
An assembly specified in the application dependencies manifest (NotificationSender.deps.json) was not found:
package: 'Microsoft.Extensions.Configuration.Abstractions', version: '2.2.0'
path: 'lib/netstandard2.0/Microsoft.Extensions.Configuration.Abstractions.dll'
我已将.NET Core 2.2.4运行时(dotnet-hosting-2.2.4-win.exe)手动安装到服务器上,并确认本地计算机具有相同的运行环境。
D:\ScheduledTasks\NotificationSender>dotnet --info
Host (useful for support):
Version: 2.2.4
Commit: f95848e524
.NET Core SDKs installed:
No SDKs were found.
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
我在服务器上安装了.NET Framework 4.6.1,应该可以满足我的要求
在Google上搜索,我发现了针对ASP Core清单(即https://www.benday.com/2018/02/23/force-dotnet-publish-to-publish-dependencies-using-publishwithaspnetcoretargetmanifest/)的修复程序,但对于控制台应用程序则没有修复程序
是否需要将.NET Standard单独安装到.NET Core 2.2? 有办法强制包含依赖文件吗?
我想我只是缺少一些基本知识。任何帮助将不胜感激。
谢谢
答案 0 :(得分:0)
问题在于发布正在针对以下本地人
\ NotificationSender \ bin \ Release \ netcoreapp2.2 \ win-x64
和
\ NotificationSender \ bin \ Debug \ netcoreapp2.2 \ publish
我只是使用了错误的文件夹