gpt4 book ai didi

c# - 使用 Visual Studio 生成错误 "MSB4006: There is a circular dependency in the target dependency graph involving target "生成“。”

转载 作者:行者123 更新时间:2023-12-05 08:08:59 25 4
gpt4 key购买 nike

我们正在尝试让 Team Foundation Server 2017 自动构建,到目前为止,我们一直只使用 Visual Studio 来构建和发布,但现在让 Team Foundation Server 来做,我们遇到了循环依赖的问题。

我们正在使用 Visual Studio 构建步骤。

解决方案 (.sln) 中有多个项目。

该项目因引用其他两个未直接或间接引用该项目的项目而爆炸。

我到处寻找一篇描述如何追踪此循环引用的文章,但到目前为止我发现的所有内容都在谈论 MSBuild,或者目标“Publish”或“Build”以外的其他内容存在问题。

错误:

[error]D:\VS2017\MSBuild\Microsoft\VisualStudio\v15.0\Web\Microsoft.Web.Publishing.targets(1279,11):

Error MSB4006: There is a circular dependency in the target dependency graph involving target "Build".

Project "D:\Agent\2.112.0_work\2\s\SLNNAME\SLNNAME.sln" (1) is building "D:\Agent\2.112.0_work\2\s\SLNNAME\Inventory\Inventory.csproj" (17) on node 1 (default targets).

D:\VS2017\MSBuild\Microsoft\VisualStudio\v15.0\Web\Microsoft.Web.Publishing.targets(1279,11): error MSB4006: There is a circular dependency in the target dependency graph involving target "Build".

[D:\Agent\2.112.0_work\2\s\SLNNAME\Inventory\Inventory.csproj]

Done Building Project "D:\Agent\2.112.0_work\2\s\SLNNAME\Inventory\Inventory.csproj" (default targets) -- FAILED.

Done Building Project "D:\Agent\2.112.0_work\2\s\SLNNAME\SLNNAME.sln" (default targets) -- FAILED.

Build FAILED.

这是我在 .sln 文件中的构建目标:

<Target Name="OverrideAppConfigWithTargetPath">
<ItemGroup>
<AppConfigWithTargetPath Remove="@(AppConfigWithTargetPath)" />
<AppConfigWithTargetPath Include="$(TransformedConfig)" Condition="'$(TransformedConfig)'!=''">
<TargetPath>$(TargetFileName).config</TargetPath>
</AppConfigWithTargetPath>
</ItemGroup>
</Target>
<Target Name="CopyTransformedConfig" Condition="'$(TargetName)' != ''">
<Copy Condition="Exists('$(TransformedConfig)')" SourceFiles="$(TransformedConfig)" DestinationFiles="$(OutputPath)$(TargetName)$(TargetExt).config" />
<Copy Condition="Exists('$(TransformedConfig)') And '$(TargetExt)' == '.exe'" SourceFiles="$(TransformedConfig)" DestinationFiles="$(OutputPath)$(TargetName).vshost.exe.config" />
</Target>
<Target Name="AfterPublish">
<PropertyGroup>
<DeployedConfig>$(_DeploymentApplicationDir)$(TargetName)$(TargetExt).config$(_DeploymentFileMappingExtension)</DeployedConfig>
</PropertyGroup>
<Copy Condition="Exists('$(DeployedConfig)')" SourceFiles="$(TransformedConfig)" DestinationFiles="$(DeployedConfig)" />
</Target>
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
</Target>

最佳答案

我遇到了同样的问题。

这对我有帮助:

https://community.embarcadero.com/blogs/entry/how-to-fix-msbuild-error-msb4006-38787

我在最后一次 checkin 的项目中添加了后期构建,不知何故,项目依赖项也被添加到 .sln 中。

它在 VS 中构建良好,但在 TFS 构建中却不行。

我刚刚撤消了对解决方案的最后更改(请参阅链接,删除新的依赖组)。

ProjectSection(ProjectDependencies) = postProject
{9D6D8692-16DD-452C-9D08-1498B3D51A9F} = {9D6D8692-16DD-452C-9D08-1498B3D51A9F}
{9BE28BBA-B3F6-4076-B989-3B1B48DACF38} = {9BE28BBA-B3F6-4076-B989-3B1B48DACF38}
EndProjectSection

不知道这是否能解决您的问题,在谷歌搜索过程中,我发现了许多类似的问题,但原因/解决方案却大相径庭。

关于c# - 使用 Visual Studio 生成错误 "MSB4006: There is a circular dependency in the target dependency graph involving target "生成“。”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43457722/

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