I am trying to run a dotnet core api (2.1.0) on my Windows Server (2012 R2) by running the following command: dotnet Api.dll
But I keep getting the following message.
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
The api runs normally on my mac, when I use the same command (dotnet Api.dll
). When I use dotnet --info
I get the following and it says the latest Runtime and SDK are installed.
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
Already tried adding the PublishWithAspNetCoreTargetManifest
part and re-publish. It did gave me more files when publishing but didn't work for my current issue.
<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" />
....
Could it be because its looking for Microsoft.AspNetCore.App
and I got Microsoft.NETCore.App 2.1.0
installed? I don't know really, I know the latest .NET core runtime and sdk are installed. Any idea what I am doing wrong?
Could it be because its looking for Microsoft.AspNetCore.App and I got Microsoft.NETCore.App 2.1.0 installed?
Yes, you are correct. You have the appropriate Microsoft.NETCore.App
runtimes installed but not the Microsoft.AspNetCore.App
runtime. Here is the link of ASP.NET Core x64 runtime Installer and here is the link for the main download page. After successful installation, your dotnet --info
command output should be similar to the below screenshot.