Docker 支持。当我尝试使用 docker 开-6ren">
gpt4 book ai didi

docker - 目标依赖图中存在涉及目标 "DockerBuildServiceReferences"的循环依赖

转载 作者:行者123 更新时间:2023-12-02 09:01:44 27 4
gpt4 key购买 nike

我正在尝试向现有的 ASP.Net(核心)Web 应用程序添加 docker 支持。

到目前为止,我所做的只是右键单击我的解决方案,然后单击添加 > Docker 支持。当我尝试使用 docker 开始调试时,出现以下错误:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\VisualStudio\v15.0\Docker\Microsoft.VisualStudio.Docker.Compose.targets(170,5): error MSB4006: There is a circular dependency in the target dependency graph involving target "DockerBuildServiceReferences".

我已经检查了 Microsoft.VisualStudio.Docker.Compose.targets 文件,但我看不到任何涉及 DockerBuildServiceReferences 的循环依赖项,事实上,我搜索了整个文件文件仅在两个地方提到:

  <!--
***********************************************************************************************

Docker Compose Project Targets

***********************************************************************************************
-->

<UsingTask TaskName="CleanWorkspace" AssemblyFile="$(DockerBuildTasksAssembly)" />
<UsingTask TaskName="EnsureMsVsMonExists" AssemblyFile="$(DockerBuildTasksAssembly)" />
<UsingTask TaskName="EnsureVsDbgExists" AssemblyFile="$(DockerBuildTasksAssembly)" />
<UsingTask TaskName="GetServiceReferences" AssemblyFile="$(DockerBuildTasksAssembly)" />
<UsingTask TaskName="PrepareForBuild" AssemblyFile="$(DockerBuildTasksAssembly)" />
<UsingTask TaskName="PrepareForLaunch" AssemblyFile="$(DockerBuildTasksAssembly)" />

<PropertyGroup>
<BuildDependsOn>
DockerSetDevelopmentMode;
DockerPrepareForBuild;
DockerGetServiceReferences;
DockerBuildServiceReferences;
$(BuildDependsOn);
DockerComposeBuild;
DockerPrepareForLaunch;
</BuildDependsOn>
<CleanDependsOn>
DockerSetDevelopmentMode;
DockerCleanWorkspace;
$(CleanDependsOn);
DockerGetServiceReferences;
DockerCleanServiceReferences;
</CleanDependsOn>
</PropertyGroup>

<PropertyGroup>
<DockerComposeProjectPath>$(MSBuildProjectFullPath)</DockerComposeProjectPath>
</PropertyGroup>

还有:

  <!--
***********************************************************************************************

TARGET : DockerBuildServiceReferences

***********************************************************************************************
-->

<Target Name="DockerBuildServiceReferences">
<PropertyGroup>
<DockerServiceReferenceTarget Condition=" '$(DockerDevelopmentMode)' == 'Regular' ">DockerPackageService</DockerServiceReferenceTarget>
<DockerServiceReferenceTarget Condition=" '$(DockerServiceReferenceTarget)' == '' ">Build</DockerServiceReferenceTarget>
</PropertyGroup>
<MSBuild Projects="@(DockerServiceReference)"
Targets="$(DockerServiceReferenceTarget)"
Properties="Configuration=$(Configuration);Platform=$(Platform);BuildingInsideVisualStudio=false"
Condition=" '@(DockerServiceReference)' != '' " />
</Target>

我还尝试从头开始创建一个新的 ASP.NET Core 应用程序,并向其添加 docker 支持,它运行得很好。这让我相信这个错误正在掩盖其他东西。

我使用的是 Visual Studio 2017,docker version 的输出如下(如果有帮助的话):

Client:
Version: 17.05.0-ce-rc1
API version: 1.27 (downgraded from 1.29)
Go version: go1.7.5
Git commit: 2878a85
Built: Wed Apr 12 19:43:25 2017
OS/Arch: windows/amd64

Server:
Version: 17.03.1-ce
API version: 1.27 (minimum version 1.12)
Go version: go1.7.5
Git commit: c6d412e
Built: Fri Mar 24 00:00:50 2017
OS/Arch: linux/amd64
Experimental: true

任何想法将不胜感激!

最佳答案

对于其他遇到此错误且 @VMAtm 答案无法解决的人。如果您在解决方案文件夹(高于 .csproj 和 dockerfile 的级别)中运行迁移命令,也可能会发生这种情况。运行迁移时请确保您位于项目文件夹中。

关于docker - 目标依赖图中存在涉及目标 "DockerBuildServiceReferences"的循环依赖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44330447/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com