问题描述
我使用以下命令在 dotnet 2.1 中为 Ubuntu 发布了我的应用程序:
I published my app for Ubuntu in dotnet 2.1 using this command:
dotnet publish -c Release -v ubuntu-x64
我在 Ubuntu 上有 .net-core 运行时.当我想在目录中运行可执行文件时,它会出现此错误:
I have .net-core run-time on Ubuntu. when i want to run the executable in the directory it gives this error:
应用程序依赖项清单中指定的程序集...未找到
但是当我进入发布目录并运行可执行文件时,它工作正常.所以我的问题是我应该在发布中使用无故障的还是应该修复一个错误?
but when i go to the publish directory and run the executable it works fine.so my question is should I use the fault-free one in publish or there's an error I should fix?
编辑(开发者机器的 .NET 核心信息):
EDIT (.NET CORE INFO FOR THE DEVELOPER MACHINE):
.NET Core SDK(反映任何 global.json):版本:2.1.300提交:adab45bf0c
运行时环境:操作系统名称:Windows 操作系统版本:10.0.15063操作系统平台:Windows RID:win10-x64 基本路径:C:ProgramFilesdotnetsdk2.1.300
Runtime Environment: OS Name: Windows OS Version: 10.0.15063 OS Platform: Windows RID: win10-x64 Base Path: C:Program Filesdotnetsdk2.1.300
主机(用于支持):版本:2.1.0 提交:caa7b7e2ba
Host (useful for support): Version: 2.1.0 Commit: caa7b7e2ba
.NET Core SDK 已安装:1.1.8 [C:Program Filesdotnetsdk]2.1.104 [C:Program Filesdotnetsdk]2.1.200 [C:Program Filesdotnetsdk]2.1.300 [C:Program Filesdotnetsdk]
.NET Core SDKs installed: 1.1.8 [C:Program Filesdotnetsdk] 2.1.104 [C:Program Filesdotnetsdk] 2.1.200 [C:Program Filesdotnetsdk] 2.1.300 [C:Program Filesdotnetsdk]
.NET Core 运行时安装:Microsoft.AspNetCore.All 2.1.0[C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.0 [C:ProgramFilesdotnetsharedMicrosoft.AspNetCore.App] Microsoft.NETCore.App1.0.10 [C:Program FilesdotnetsharedMicrosoft.NETCore.App] Microsoft.NETCore.App 1.1.7 [C:ProgramFilesdotnetsharedMicrosoft.NETCore.App] Microsoft.NETCore.App2.0.6 [C:Program FilesdotnetsharedMicrosoft.NETCore.App] Microsoft.NETCore.App 2.0.7 [C:ProgramFilesdotnetsharedMicrosoft.NETCore.App] Microsoft.NETCore.App2.1.0 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.0 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.0 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App] Microsoft.NETCore.App 1.0.10 [C:Program FilesdotnetsharedMicrosoft.NETCore.App] Microsoft.NETCore.App 1.1.7 [C:Program FilesdotnetsharedMicrosoft.NETCore.App] Microsoft.NETCore.App 2.0.6 [C:Program FilesdotnetsharedMicrosoft.NETCore.App] Microsoft.NETCore.App 2.0.7 [C:Program FilesdotnetsharedMicrosoft.NETCore.App] Microsoft.NETCore.App 2.1.0 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
编辑(Ubuntu 机器的 .NET 核心信息):
EDIT (.NET CORE INFO FOR THE UBUNTU MACHINE):
.NET Core SDK(反映任何 global.json):版本:2.1.300提交:adab45bf0c
运行时环境:操作系统名称:ubuntu 操作系统版本:18.04 操作系统平台:Linux RID:ubuntu.18.04-x64 基本路径:
/usr/share/dotnet/sdk/2.1.300/
Runtime Environment: OS Name: ubuntu OS Version: 18.04 OS Platform: Linux RID: ubuntu.18.04-x64 Base Path:
/usr/share/dotnet/sdk/2.1.300/
主机(用于支持):版本:2.1.0 提交:caa7b7e2ba
Host (useful for support): Version: 2.1.0 Commit: caa7b7e2ba
.NET Core SDK 已安装:2.1.300 [/usr/share/dotnet/sdk]
.NET Core SDKs installed: 2.1.300 [/usr/share/dotnet/sdk]
.NET Core 运行时安装:Microsoft.AspNetCore.All 2.1.0[/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
微软.AspNetCore.App 2.1.0[/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
微软.NETCore.App 2.0.7[/usr/share/dotnet/shared/Microsoft.NETCore.App]
微软.NETCore.App 2.1.0[/usr/share/dotnet/shared/Microsoft.NETCore.App]
.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.7 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
推荐答案
您安装了错误的 .NET Core Runtime/SDK.您应该安装最新的 .NET Core 2.1 SDK 或运行时来运行您的 .NET Core2.1 正确应用.
You installed the wrong .NET Core Runtime/SDK. You should install the latest .NET Core 2.1 SDK or Runtime to run your .NET Core 2.1 application correctly.
- .NET Core 2.1 SDK 版本号应为
v2.1.300
. - .NET Core 2.1 运行时版本号应为
v2.1.0
.
这篇关于已发布的 .Net-Core 应用程序将无法运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!