【发布时间】:2018-11-26 15:12:57
【问题描述】:
我正在尝试通过运行以下命令在我的 Windows Server (2012 R2) 上运行 dotnet core api (2.1.0):dotnet Api.dll 但我不断收到以下消息。
The specified framework 'Microsoft.AspNetCore.App', version '2.1.0' was not found.
- Check application dependencies and target a framework version installed at:
C:\Program Files\dotnet\
- Installing .NET Core prerequisites might help resolve this problem:
http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
- The .NET Core framework and SDK can be installed from:
https://aka.ms/dotnet-download
当我使用相同的命令 (dotnet Api.dll) 时,api 在我的 mac 上正常运行。当我使用 dotnet --info 时,我得到以下信息,它说安装了最新的运行时和 SDK。
Runtime Environment:
OS Name: Windows
OS Version: 6.3.9600
OS Platform: Windows
RID: win81-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.300\
Host (useful for support):
Version: 2.1.0
Commit: caa7b7e2ba
.NET Core SDKs installed:
2.1.201 [C:\Program Files\dotnet\sdk]
2.1.300 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.
App]
Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.
App]
Microsoft.NETCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.
App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
已经尝试添加PublishWithAspNetCoreTargetManifest 部分并重新发布。它在发布时确实为我提供了更多文件,但不适用于我当前的问题。
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
-> <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest> <-
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.0" />
....
可能是因为它正在寻找Microsoft.AspNetCore.App 而我安装了Microsoft.NETCore.App 2.1.0?我真的不知道,我知道安装了最新的 .NET Core 运行时和 sdk。知道我做错了什么吗?
【问题讨论】: