c# - 无法生成:Microsoft/aspnetcore的 list :2.1找不到Visual Studio 7.5.2 Mac OS X

标签 c# asp.net asp.net-mvc docker asp.net-core

我已经在Mac OS X中使用Visual Studio 7.5.2创建了一个Asp.net 2.1 Web API项目。我向该项目添加了docker支持,但是在构建时,该项目不断出现错误,指出:failed to build: manifest for microsoft/aspnetcore:2.1 not found.

项目的Docker文件

FROM microsoft/aspnetcore:2.1 AS base
WORKDIR /app
EXPOSE 80

FROM microsoft/aspnetcore-build:2.1 AS build
WORKDIR /src
COPY MeroRentalDev.sln ./
COPY Auth.API/Auth.API.csproj Auth.API/
RUN dotnet restore -nowarn:msb3202,nu1503
COPY . .
WORKDIR /src/Auth.API
RUN dotnet build -c Release -o /app

FROM build AS publish
RUN dotnet publish -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "Auth.API.dll"]

dockerfile.yml
version: '3.4'

    services:
      auth.api:
        image: auth
        build:
          context: .
          dockerfile: Auth.API/Dockerfile

完整的错误详细信息
Building: docker-compose (Debug)
Build started 8/06/2018 3:05:13 PM.
__________________________________________________
Project "/Users/macbook/Projects/MeroRentalDev/docker-compose.dcproj" (Build target(s)):

Target DockerResolveAppType:
    __________________________________________________
    Project "/Users/macbook/Projects/MeroRentalDev/docker-compose.dcproj" is building "/Users/macbook/Projects/MeroRentalDev/Auth.API/Auth.API.csproj" (DockerResolveAppType target(s)):

Target DockerResolveTargetFramework:
    __________________________________________________
    Project "/Users/macbook/Projects/MeroRentalDev/docker-compose.dcproj" is building "/Users/macbook/Projects/MeroRentalDev/Auth.API/Auth.API.csproj" (DockerResolveTargetFramework target(s)):

Target DockerResolveProjectInputAndOutput:
    __________________________________________________
    Project "/Users/macbook/Projects/MeroRentalDev/docker-compose.dcproj" is building "/Users/macbook/Projects/MeroRentalDev/Auth.API/Auth.API.csproj" (DockerResolveProjectInputAndOutput target(s)):

Target DockerPrepareForBuild:
    docker ps --filter "status=running" --filter "name=dockercompose763682937431840732_auth.api_" --format {{.ID}} -n 1
Target DockerBuildServiceReferences:
    __________________________________________________
    Project "/Users/macbook/Projects/MeroRentalDev/docker-compose.dcproj" is building "/Users/macbook/Projects/MeroRentalDev/Auth.API/Auth.API.csproj" (Build target(s)):

    Target _HandlePackageFileConflicts:
        Encountered conflict between 'Reference:/usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Collections.Immutable.dll' and 'Reference:/Users/macbook/.nuget/packages/system.collections.immutable/1.5.0/lib/netstandard2.0/System.Collections.Immutable.dll'.  Choosing 'Reference:/usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Collections.Immutable.dll' because it comes from a package that is preferred.
        Encountered conflict between 'Reference:/usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Diagnostics.DiagnosticSource.dll' and 'Reference:/Users/macbook/.nuget/packages/system.diagnostics.diagnosticsource/4.5.0/lib/netstandard1.3/System.Diagnostics.DiagnosticSource.dll'.  Choosing 'Reference:/usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Diagnostics.DiagnosticSource.dll' because it comes from a package that is preferred.
        Encountered conflict between 'Reference:/usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Reflection.Metadata.dll' and 'Reference:/usr/local/share/dotnet/sdk/NuGetFallbackFolder/system.reflection.metadata/1.6.0/lib/netstandard2.0/System.Reflection.Metadata.dll'.  Choosing 'Reference:/usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Reflection.Metadata.dll' because it comes from a package that is preferred.
        Encountered conflict between 'Reference:/usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Runtime.Serialization.Xml.dll' and 'Reference:/Users/macbook/.nuget/packages/system.runtime.serialization.xml/4.3.0/ref/netstandard1.3/System.Runtime.Serialization.Xml.dll'.  Choosing 'Reference:/usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Runtime.Serialization.Xml.dll' because AssemblyVersion '4.1.4.0' is greater than '4.1.1.0'.
        Encountered conflict between 'Platform:Microsoft.Win32.Registry.dll' and 'Runtime:/usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.win32.registry/4.5.0/lib/netstandard2.0/Microsoft.Win32.Registry.dll'.  Choosing 'Platform:Microsoft.Win32.Registry.dll' because it comes from a package that is preferred.
        Encountered conflict between 'Platform:System.Collections.Immutable.dll' and 'Runtime:/Users/macbook/.nuget/packages/system.collections.immutable/1.5.0/lib/netstandard2.0/System.Collections.Immutable.dll'.  Choosing 'Platform:System.Collections.Immutable.dll' because it comes from a package that is preferred.
        Encountered conflict between 'Platform:System.Diagnostics.DiagnosticSource.dll' and 'Runtime:/Users/macbook/.nuget/packages/system.diagnostics.diagnosticsource/4.5.0/lib/netstandard1.3/System.Diagnostics.DiagnosticSource.dll'.  Choosing 'Platform:System.Diagnostics.DiagnosticSource.dll' because it comes from a package that is preferred.
        Encountered conflict between 'Platform:System.Reflection.Metadata.dll' and 'Runtime:/usr/local/share/dotnet/sdk/NuGetFallbackFolder/system.reflection.metadata/1.6.0/lib/netstandard2.0/System.Reflection.Metadata.dll'.  Choosing 'Platform:System.Reflection.Metadata.dll' because it comes from a package that is preferred.
        Encountered conflict between 'Platform:System.Runtime.Serialization.Xml.dll' and 'Runtime:/Users/macbook/.nuget/packages/system.runtime.serialization.xml/4.3.0/lib/netstandard1.3/System.Runtime.Serialization.Xml.dll'.  Choosing 'Platform:System.Runtime.Serialization.Xml.dll' because AssemblyVersion '4.1.4.0' is greater than '4.1.2.0'.
        Encountered conflict between 'Platform:System.Security.AccessControl.dll' and 'Runtime:/usr/local/share/dotnet/sdk/NuGetFallbackFolder/system.security.accesscontrol/4.5.0/lib/netstandard2.0/System.Security.AccessControl.dll'.  Choosing 'Platform:System.Security.AccessControl.dll' because it comes from a package that is preferred.
        Encountered conflict between 'Platform:System.Security.Cryptography.Cng.dll' and 'Runtime:/usr/local/share/dotnet/sdk/NuGetFallbackFolder/system.security.cryptography.cng/4.5.0/lib/netcoreapp2.1/System.Security.Cryptography.Cng.dll'.  Choosing 'Platform:System.Security.Cryptography.Cng.dll' because it comes from a package that is preferred.
        Encountered conflict between 'Platform:System.Security.Principal.Windows.dll' and 'Runtime:/usr/local/share/dotnet/sdk/NuGetFallbackFolder/system.security.principal.windows/4.5.0/lib/netstandard2.0/System.Security.Principal.Windows.dll'.  Choosing 'Platform:System.Security.Principal.Windows.dll' because it comes from a package that is preferred.
        Encountered conflict between 'Platform:Microsoft.Win32.Registry.dll' and 'Runtime:/usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.win32.registry/4.5.0/runtimes/unix/lib/netstandard2.0/Microsoft.Win32.Registry.dll'.  Choosing 'Platform:Microsoft.Win32.Registry.dll' because it comes from a package that is preferred.
        Encountered conflict between 'Platform:Microsoft.Win32.Registry.dll' and 'Runtime:/usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.win32.registry/4.5.0/runtimes/win/lib/netstandard2.0/Microsoft.Win32.Registry.dll'.  Choosing 'Platform:Microsoft.Win32.Registry.dll' because it comes from a package that is preferred.
        Encountered conflict between 'Platform:System.Security.AccessControl.dll' and 'Runtime:/usr/local/share/dotnet/sdk/NuGetFallbackFolder/system.security.accesscontrol/4.5.0/runtimes/win/lib/netcoreapp2.0/System.Security.AccessControl.dll'.  Choosing 'Platform:System.Security.AccessControl.dll' because it comes from a package that is preferred.
        Encountered conflict between 'Platform:System.Security.Cryptography.Cng.dll' and 'Runtime:/usr/local/share/dotnet/sdk/NuGetFallbackFolder/system.security.cryptography.cng/4.5.0/runtimes/win/lib/netcoreapp2.1/System.Security.Cryptography.Cng.dll'.  Choosing 'Platform:System.Security.Cryptography.Cng.dll' because it comes from a package that is preferred.
        Encountered conflict between 'Platform:System.Security.Principal.Windows.dll' and 'Runtime:/usr/local/share/dotnet/sdk/NuGetFallbackFolder/system.security.principal.windows/4.5.0/runtimes/unix/lib/netcoreapp2.0/System.Security.Principal.Windows.dll'.  Choosing 'Platform:System.Security.Principal.Windows.dll' because it comes from a package that is preferred.
        Encountered conflict between 'Platform:System.Security.Principal.Windows.dll' and 'Runtime:/usr/local/share/dotnet/sdk/NuGetFallbackFolder/system.security.principal.windows/4.5.0/runtimes/win/lib/netcoreapp2.0/System.Security.Principal.Windows.dll'.  Choosing 'Platform:System.Security.Principal.Windows.dll' because it comes from a package that is preferred.
    Target GenerateTargetFrameworkMonikerAttribute:
      Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
    Target _CoreGenerateRazorAssemblyInfo:
      Skipping target "_CoreGenerateRazorAssemblyInfo" because all output files are up-to-date with respect to the input files.
    Target CoreGenerateAssemblyInfo:
      Skipping target "CoreGenerateAssemblyInfo" because all output files are up-to-date with respect to the input files.
    Target CoreCompile:
      Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
    Target GenerateBuildDependencyFile:
      Skipping target "GenerateBuildDependencyFile" because all output files are up-to-date with respect to the input files.
    Target GenerateBuildRuntimeConfigurationFiles:
      Skipping target "GenerateBuildRuntimeConfigurationFiles" because all output files are up-to-date with respect to the input files.
    Target CopyFilesToOutputDirectory:
        Auth.API -> /Users/macbook/Projects/MeroRentalDev/Auth.API/bin/Debug/netcoreapp2.1/Auth.API.dll
Target DockerUpdateComposeVsGeneratedFiles:
    __________________________________________________
    Project "/Users/macbook/Projects/MeroRentalDev/docker-compose.dcproj" is building "/Users/macbook/Projects/MeroRentalDev/Auth.API/Auth.API.csproj" (DockerUpdateComposeVsGeneratedFiles target(s)):

    Copying file from "/Users/macbook/Projects/MeroRentalDev/obj/Docker/docker-compose.vs.debug.partial.g.yml" to "/Users/macbook/Projects/MeroRentalDev/obj/Docker/docker-compose.vs.debug.g.yml".
    Copying file from "/Users/macbook/Projects/MeroRentalDev/obj/Docker/docker-compose.vs.release.partial.g.yml" to "/Users/macbook/Projects/MeroRentalDev/obj/Docker/docker-compose.vs.release.g.yml".
Target DockerPrepareForLaunch:
    docker-compose  -f "/Users/macbook/Projects/MeroRentalDev/docker-compose.yml" -f "/Users/macbook/Projects/MeroRentalDev/docker-compose.override.yml" -f "/Users/macbook/Projects/MeroRentalDev/obj/Docker/docker-compose.vs.debug.g.yml" -p dockercompose763682937431840732 --no-ansi up -d --build --force-recreate --remove-orphans
    Building auth.api
    Step 1/3 : FROM microsoft/aspnetcore:2.1 AS base
    Service 'auth.api' failed to build: manifest for microsoft/aspnetcore:2.1 not found
    /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/AddIns/docker/MonoDevelop.Docker/MSbuild/Sdks/Microsoft.Docker.Sdk/build/Microsoft.VisualStudio.Docker.Compose.targets(363,5): error : Building auth.api
    /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/AddIns/docker/MonoDevelop.Docker/MSbuild/Sdks/Microsoft.Docker.Sdk/build/Microsoft.VisualStudio.Docker.Compose.targets(363,5): error : Service 'auth.api' failed to build: manifest for microsoft/aspnetcore:2.1 not found.
    /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/AddIns/docker/MonoDevelop.Docker/MSbuild/Sdks/Microsoft.Docker.Sdk/build/Microsoft.VisualStudio.Docker.Compose.targets(363,5): error : 
    /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/AddIns/docker/MonoDevelop.Docker/MSbuild/Sdks/Microsoft.Docker.Sdk/build/Microsoft.VisualStudio.Docker.Compose.targets(363,5): error : For more troubleshooting information, go to http://aka.ms/DockerToolsTroubleshooting
Done building target "DockerPrepareForLaunch" in project "docker-compose.dcproj" -- FAILED.

Done building project "docker-compose.dcproj" -- FAILED.

Build FAILED.

/Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/AddIns/docker/MonoDevelop.Docker/MSbuild/Sdks/Microsoft.Docker.Sdk/build/Microsoft.VisualStudio.Docker.Compose.targets(363,5): error : Building auth.api
/Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/AddIns/docker/MonoDevelop.Docker/MSbuild/Sdks/Microsoft.Docker.Sdk/build/Microsoft.VisualStudio.Docker.Compose.targets(363,5): error : Service 'auth.api' failed to build: manifest for microsoft/aspnetcore:2.1 not found.
/Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/AddIns/docker/MonoDevelop.Docker/MSbuild/Sdks/Microsoft.Docker.Sdk/build/Microsoft.VisualStudio.Docker.Compose.targets(363,5): error : 
/Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/AddIns/docker/MonoDevelop.Docker/MSbuild/Sdks/Microsoft.Docker.Sdk/build/Microsoft.VisualStudio.Docker.Compose.targets(363,5): error : For more troubleshooting information, go to http://aka.ms/DockerToolsTroubleshooting
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:07.03

---------------------- Done ----------------------

Build: 1 error, 0 warnings

我从这些链接尝试了一些解决方案:

AspNetCore:2.1 not found

Cannot run Dot net core preview project on Docker

我使用以下命令将Docker镜像更新为最新版本,但仍然存在相同的问题。
Pulling from microsoft/dotnet

Pulling from microsoft/aspnetcore-build

最佳答案

找到了解决方案,但不确定这是正确的解决方案。链接-https://hub.docker.com/r/microsoft/aspnetcore/

如下更改docker文件

删除microsoft / aspnetcore-build:2.1到microsoft / aspnetcore-build

FROM microsoft/aspnetcore-build AS base
WORKDIR /app
EXPOSE 80

FROM microsoft/aspnetcore-build AS build
WORKDIR /src
COPY MeroRentalDev.sln ./
COPY Auth.API/Auth.API.csproj Auth.API/
RUN dotnet restore -nowarn:msb3202,nu1503
COPY . .
WORKDIR /src/Auth.API
RUN dotnet build -c Release -o /app

FROM build AS publish
RUN dotnet publish -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "Auth.API.dll"]

ASP.NET Core运行时Docker镜像
该存储库包含用于运行已发布的ASP.NET Core应用程序的图像。这些镜像仅包含运行时。使用microsoft / aspnetcore-build在容器内构建ASP.NET Core应用。

关于c# - 无法生成:Microsoft/aspnetcore的 list :2.1找不到Visual Studio 7.5.2 Mac OS X,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50753727/

相关文章:

c# - 如何在单程中替换多次出现?

c# - 将单元格转换为选中复选框的文本框

c# - Razor C# - 从数据库中获取数据

c# - 如何将 C# 原型(prototype)编写为 P/Invoke 一个以 char* 作为参数并返回其值的函数

C# 将作为泛型对象返回的数组转换为不同的基础类型

asp.net-mvc - WebService 还是简单的 MVC Controller ?

ajax - 使用 MVC 4 API Controller 发布 JSON

asp.net-mvc - 为 id 设置 HtmlFieldPrefix 但不是名称

c# - 在 ASP.NET 中用 C# 将文件写入响应

asp.net - 如何手动将其他行添加到 ASP.NET gridview 的底部?