docker - How to update asp.net core version in dockerfile
问题描述
I'm building a docker container as a step in Azure DevOps pipeline and using the provided build pools. When I try to run the container, I get the error below. I understand I need to update the asp.net version as I build the container, and I'm looking for a command line that I can add to my Dockerfile to do so.
I've found a number of places to download the correct version but have not found a good way to put the download & install as a command in a docker file.
My Dockerfile is quite simple and is based on Windows 1803.
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-nanoserver-sac2016 AS runtime
WORKDIR /app
COPY SampleMvcApp/out ./
ENTRYPOINT ["dotnet", "Meta-Analytics.dll"]
A snippet from the error I get is below:
The specified framework 'Microsoft.AspNetCore.All', version '2.2.5' was not found.
The following versions are installed:
2.2.2 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
解决方案
似乎该项目在某个时候进行了升级,但并未遵循所有迁移选项。
Microsoft.AspNetCore.All
在 2.1 版中已弃用对 的支持。您应该将其替换为Microsoft.AspNetCore.App
并且您不应该指定版本。
<PackageReference Include="Microsoft.AspNetCore.App" />
有关详细信息,请参阅https://docs.microsoft.com/en-us/aspnet/core/fundamentals/metapackage?view=aspnetcore-2.2#migrate和https://docs.microsoft.com/en-us/aspnet/核心/迁移/20_21?view=aspnetcore-2.2
推荐阅读
- html - 如何将 ng2-dnd 应用于背景图像?
- terraform - Terraform - 在 Azure 上提供静态 IP 地址
- bash - Makefile {a,b,c} 通配符等效
- arrays - 如何打印一个数组并向 Bash 中的每个项目添加一个字符串
- javascript - 行号自动添加
- c# - 如何在 ASP.Net Core Razor 页面上重定向
- python - Tkinter:从窗口中使用 get() 读取 int
- java - 对每个请求使用 Chrome 和 Tomcat 时的新 HttpSession
- google-bigquery - BigQuery - 排除具有某些值的排除记录
- c# - asp core 2 mvc 不尊重模式、模板或路由