简体   繁体   中英

It was not possible to find any compatible framework version The specified framework 'Microsoft.AspNetCore.App', version '2.2.0' was not found

Results of docker build:
λ docker build -t simple-dotnet-api .
Sending build context to Docker daemon 252.4kB
Step 1/4 : FROM mcr.microsoft.com/dotnet/core/sdk:2.2
---> 08663b8eaa01
Step 2/4 : COPY . app/
---> 41fe9231d66e
Step 3/4 : RUN dotnet --version
---> Running in 1c8deb00927c
2.2.300
Removing intermediate container 1c8deb00927c
---> a9d0f880a76f
Step 4/4 : ENTRYPOINT ["dotnet", "app/simple-dotnet-api.dll"]
---> Running in 6d6f9bc34999
Removing intermediate container 6d6f9bc34999
---> 5e915f348c7e
Successfully built 5e915f348c7e
Successfully tagged simple-dotnet-api:latest
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.

Result of docker start:
λ docker start -ia condescending_fermat
It was not possible to find any compatible framework version
The specified framework 'Microsoft.AspNetCore.App', 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
λ dotnet --info
A compatible SDK version for global.json version: [2.2.0] from [C:\Users\coreyp\source\repos\simple-dotnet-api\bin\Release\netcoreapp2.2\publish\global.json] was not found

Host (useful for support):
Version: 2.2.3
Commit: 6b8ad509b6

.NET Core SDKs installed:
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.401 [C:\Program Files\dotnet\sdk]
2.1.504 [C:\Program Files\dotnet\sdk]
2.2.105 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.3-servicing-26724-03 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download

   Dockerfile:

   FROM mcr.microsoft.com/dotnet/core/sdk:2.2
   COPY . app/
   RUN dotnet --version
   ENTRYPOINT ["dotnet", "app/simple-dotnet-api.dll"]

I am thinking, just by reviewing these briefly that version 2.2.300 is being downloaded in the container but my app is setup for 2.0.0. However, I'm not certain how to fix it. Can I specify 2.0.0 in the container, if so, how? Can I force my app to use 2.2.300? When I tried to do so I was unable to update several dependencies.

Corey

If you have a file named "global.json" in your project directory, update the sdk target in there to 2.2.300. If you don't have the file, create it with the following contents.

{
  "sdk": {
    "version": "2.2.300"
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM