在发布模式下将aspnet核心应用构建为Docker映像的问题

时间:2018-10-11 15:27:09

标签: docker asp.net-core nuget

im使用docker构建应用程序在aspnet核心中,无论是在调试模式下对iis还是docker都适用,但是当我想在发布模式下构建docker映像时,尝试从错误的源下载nuget后会失败。

1>/src/datacenter/datacenter.csproj : error NU1101: Unable to find package XXXX. No packages exist with this id in source(s): nuget.org
1>/src/datacenter/datacenter.csproj : error NU1101: Unable to find package XXXX. No packages exist with this id in source(s): nuget.org
1>/src/datacenter/datacenter.csproj : error NU1101: Unable to find package XXXX. No packages exist with this id in source(s): nuget.org
1>/src/datacenter/datacenter.csproj : error NU1101: Unable to find package XXXX. No packages exist with this id in source(s): nuget.org
1>  Generating MSBuild file /src/datacenter/obj/datacenter.csproj.nuget.g.props.
1>  Generating MSBuild file /src/datacenter/obj/datacenter.csproj.nuget.g.targets.
1>  Restore failed in 15.91 sec for /src/datacenter/datacenter.csproj.
1>The command '/bin/sh -c dotnet restore "datacenter/datacenter.csproj"' returned a non-zero code: 1
1>C:\Users\.nuget\packages\microsoft.visualstudio.azure.containers.tools.targets\1.0.1916590\build\Container.targets(222,5): error : An error occurred while attempting to build Docker image.
1>Done building project "datacenter.csproj" -- FAILED.

未找到的螺母应从本地软件包服务器装入。 我还发现,当我将Container.targets中的容器开发模式更改为始终快速时,它可以正常工作。

<PropertyGroup Condition="'$(ContainerDevelopmentMode)' == ''">
  <ContainerDevelopmentMode Condition="'$(Configuration)' == 'Debug'">Fast</ContainerDevelopmentMode>
  <ContainerDevelopmentMode Condition="'$(ContainerDevelopmentMode)' == ''">Regular</ContainerDevelopmentMode>
</PropertyGroup>

所以我的问题是我应该使用“常规”开发模式还是有人针对此问题有更正确的解决方案?谢谢

0 个答案:

没有答案