Nouman Bhatti
Nouman Bhatti

Reputation: 1421

The specified framework 'Microsoft.AspNetCore.All', version '2.2.0' was not found

Dotnet --version says 2.2.402

dotnet --info says

.NET Core SDK (reflecting any global.json):
 Version:   2.2.402
 Commit:    c7f2f96116

Runtime Environment:
 OS Name:     centos
 OS Version:  7
 OS Platform: Linux
 RID:         centos.7-x64
 Base Path:   /usr/share/dotnet/sdk/2.2.402/

Host (useful for support):
  Version: 2.2.8
  Commit:  b9aa1abc51

.NET Core SDKs installed:
  2.2.402 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.NETCore.App 2.2.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

I'm trying to publish my app on linux server which is working quite fine on server till my last try to update the application on server using the below command.

dotnet publish -c release -o ${API_PUBLISH_DIR}

the build process is throwing the following error

It was not possible to find any compatible framework version The specified framework 'Microsoft.AspNetCore.All', version '2.2.0' was not found. - Check application dependencies and target a framework version installed at: /usr/share/dotnet/ - Installing .NET Core prerequisites might help resolve this problem: https://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409 - The .NET Core framework and SDK can be installed from: https://aka.ms/dotnet-download

more error details is.

/usr/share/dotnet/sdk/NuGetFallbackFolder/microsoft.aspnetcore.mvc.razor.viewcompilation/2.2.0/build/netstandard2.0/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets(64,5): error MSB3073: The command ""/usr/share/dotnet/dotnet" exec --runtimeconfig "/home/vng-dev/vng-web/vast-webapplication/vast_webapplication/WebAPI/bin/Release/netcoreapp2.2/WebAPI.runtimeconfig.json" --depsfile "/home/vng-dev/vng-web/vast-webapplication/vast_webapplication/WebAPI/bin/Release/netcoreapp2.2/WebAPI.deps.json" "/usr/share/dotnet/sdk/NuGetFallbackFolder/microsoft.aspnetcore.mvc.razor.viewcompilation/2.2.0/build/netstandard2.0/netcoreapp2.0/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.dll" @"obj/Release/netcoreapp2.2/microsoft.aspnetcore.mvc.razor.viewcompilation.rsp"" exited with code 150. [/home/vng-dev/vng-web/vast-webapplication/vast_webapplication/WebAPI/WebAPI.csproj]

I didn't mentioned the version in .csproj file for AspNetCore.All and it's like this

<PackageReference Include="Microsoft.AspNetCore.All" />

also tried replacing AspNetCore.All with AspNetCore.App like below

<PackageReference Include="Microsoft.AspNetCore.App" />

this also doesn't help

I also tried with installing AspNetCore.MVC.Razor.ViewCompilation package but it doesn't help

EDIT:

  1. Also tried updating the versions of both Microsoft.AspNetCore.App and Microsoft.AspNetCore.All one at a time.
  2. tried compiling the app with versions attribute and without versions attribute.
  3. Tried updating all the project (.csproj) files in the solution.

Upvotes: 0

Views: 4969

Answers (3)

mihir patel
mihir patel

Reputation: 11

  • Add dotnet core 2.0 version in your Project

< PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.6"/>

  • Also Add In property group
<PropertyGroup>
  <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
</PropertyGroup>

Upvotes: 0

Nouman Bhatti
Nouman Bhatti

Reputation: 1421

For me it turns out issue in the build command

I'm using this command -> dotnet publish -c release -o ${API_PUBLISH_DIR}

changed this and add the platform on which I'm building it

dotnet publish -c release -r linux-x64 -o ${API_PUBLISH_DIR}

The recent automatic updates to .net core messes up something and couldn't figure out where are the version dependencies.

Upvotes: 1

prisar
prisar

Reputation: 3195

Your project has a reference of Microsoft.AspNetCore.All similar to what given below. But you have installed dotnet core 2.2.x, after dotnet core 2.0 Microsoft.AspNetCore.All is being removed. Microsoft.NETCore.App is much lighter version similar to that package.

I would suggest installing dotnet core 2.0. In that case, you dont need to change your project.

<PackageReference Include="Microsoft.AspNetCore.All"/>

Upvotes: 0

Related Questions