无法构建:Microsoft / aspnetcore清单:2.1未找到Visual Studio 7.5.2 Mac OS X.

时间:2018-06-08 05:09:56

标签: 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支持但是在构建时,项目不断收到错误消息:{{1} }。

项目的Docker文件

failed to build: manifest for microsoft/aspnetcore:2.1 not found.

dockerfile.yml

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"]

完整的错误详情

version: '3.4'

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

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

AspNetCore:2.1 not found

Cannot run Dot net core preview project on Docker

我使用以下命令将docker镜像更新到最新版本,但仍然遇到了同样的问题。

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

2 个答案:

答案 0 :(得分:2)

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

如下所示更改泊坞窗文件

删除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核心运行时Docker镜像 此存储库包含用于运行已发布的ASP.NET Core应用程序的映这些图像仅包含运行时。使用microsoft / aspnetcore-build在容器内构建ASP.NET Core应用程序。

答案 1 :(得分:0)

他们将docker映像移动了2.1,您必须更新自动生成的docker文件。详细信息在https://github.com/aspnet/aspnet-docker/tree/master/2.1