1.Install .NET Core 2.2.100 sdk
2.Create a new 'AspNetCore Web Api' by using Visual Studio 2017,and enbale docker support.
3.F5 ,application could not run and Output Window Shows:
It was not possible to find any compatible framework version
The specified framework 'Microsoft.AspNetCore.App', version '2.2.0' was not found.
Run successfully
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:
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 following versions are installed:
2.2.0-preview3-35497 at [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
2.2-aspnetcore-runtime image is using preview runtime.
PS D:\Projects\TestDemo> docker run -it microsoft/dotnet:2.2-aspnetcore-runtime bash
root@55c8a6b78166:/# dotnet
Usage: dotnet [options]
Usage: dotnet [path-to-application]
Options:
-h|--help Display help.
--info Display .NET Core information.
--list-sdks Display the installed SDKs.
--list-runtimes Display the installed runtimes.
path-to-application:
The path to an application .dll file to execute.
root@55c8a6b78166:/# dotnet --info
Host (useful for support):
Version: 2.2.0-preview3-27014-02
Commit: 525082ca3e
.NET Core SDKs installed:
No SDKs were found.
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.0-preview3-35497 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.0-preview3-35497 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.0-preview3-27014-02 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
docker versionClient: Docker Engine - Community
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:47:51 2018
OS/Arch: windows/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.0
API version: 1.39 (minimum version 1.12)
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:55:00 2018
OS/Arch: linux/amd64
Experimental: false
docker infoContainers: 26
Running: 23
Paused: 0
Stopped: 3
Images: 40
Server Version: 18.09.0
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 468a545b9edcd5932818eb9de8e72413e616e86e
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.125-linuxkit
Operating System: Docker for Windows
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 3.837GiB
Name: linuxkit-00155d0c9b0b
ID: 6T73:DO35:77LO:3LN3:2NDJ:BC7Q:4LOO:JAOH:GKLT:WW43:N7RP:G5AP
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 152
Goroutines: 147
System Time: 2018-12-14T03:28:03.803519Z
EventsListeners: 1
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Registry Mirrors:
https://registry.docker-cn.com/
Live Restore Enabled: false
Product License: Community Engine
I fix this problem by change Dockerfile
FROM microsoft/dotnet:2.2.0-aspnetcore-runtime AS base instead of FROM microsoft/dotnet:2.2-aspnetcore-runtime AS base
@1015450578 - are you sure you have the most recent image pulled locally? The microsoft/dotnet:2.2-aspnetcore-runtime tag is a floating tag. Prior to 2.2 being released this tag pointed to the various preview releases. It appears to me that you pulled this tag during preview and didn't re-pull once RTM was released.
PS D:\repos\dotnet-docker> docker pull microsoft/dotnet:2.2-aspnetcore-runtime
2.2-aspnetcore-runtime: Pulling from microsoft/dotnet
a5a6f2f73cd8: Already exists
1e6f560accc2: Pull complete
8176b77dc10d: Pull complete
e21dd5015bb0: Pull complete
Digest: sha256:aa0a2796afcc050427a1abd481252e4b9220c267740afe195d00231f51e5e335
Status: Downloaded newer image for microsoft/dotnet:2.2-aspnetcore-runtime
PS D:\repos\dotnet-docker> docker run -it --rm microsoft/dotnet:2.2-aspnetcore-runtime dotnet
Usage: dotnet [options]
Usage: dotnet [path-to-application]
Options:
-h|--help Display help.
--info Display .NET Core information.
--list-sdks Display the installed SDKs.
--list-runtimes Display the installed runtimes.
path-to-application:
The path to an application .dll file to execute.
PS D:\repos\dotnet-docker> docker run -it --rm microsoft/dotnet:2.2-aspnetcore-runtime dotnet --info
Host (useful for support):
Version: 2.2.0
Commit: 1249f08fed
.NET Core SDKs installed:
No SDKs were found.
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Related to https://github.com/dotnet/announcements/issues/93#issuecomment-447200268. FWIW this is the correct repo to log all issues related to the microsoft/dotnet Docker images.
the docker image that I pulled:
REPOSITORY TAG IMAGE ID CREATED SIZE
microsoft/dotnet 2.2-aspnetcore-runtime 4714305f479e 4 weeks ago 260MB
.NET Core 2.2.0 was released on Dec 4 - https://blogs.msdn.microsoft.com/dotnet/2018/12/04/announcing-net-core-2-2/. Your image is a preview version. Please re-pull the image via - docker pull microsoft/dotnet 2.2-aspnetcore-runtime to get the latest image.
Closing as there was a preview version of the 2.2 image cached locally. Images need to be explicitly re-pulled when new ones are available.
Most helpful comment
I fix this problem by change Dockerfile
FROM microsoft/dotnet:2.2.0-aspnetcore-runtime AS baseinstead ofFROM microsoft/dotnet:2.2-aspnetcore-runtime AS base