Skip to content

Circular dependency error when publishing webdeploy package using .net 5.0.300 #35134

Description

@davidsk

I am getting the following error when I try and generate a webdeploy package using .net 5:
C:\Program

Files\dotnet\sdk\5.0.300\Sdks\Microsoft.NET.Sdk.Publish\targets\CopyTargets\Microsoft.NET.Sdk.Publish.CopyFiles.targets(80,5): error MSB4006: There is a circular dependency in the target dependency graph involving target "Publish". Since "_CopyAspNetCoreFilesToIntermediateOutputPath" has "DependsOn" dependence on "Publish", the circular is "Publish<-_CopyAspNetCoreFilesToIntermediateOutputPath<-CorePublish<-DotNetPublish<-_PublishBuildAlternative<-Publish"

Repro steps:
dotnet new mvc -n mvcApp
cd mvcApp
dotnet restore
dotnet publish /p:WebDeployMethod=package /p:DeployOnBuild=true;

expected result:
Web Deploy Package produced

actual result:
Microsoft (R) Build Engine version 16.10.0+4242f381a for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

Determining projects to restore...
All projects are up-to-date for restore.
mvcApp -> C:\Temp\mvcApp\bin\Debug\net5.0\mvcApp.dll
mvcApp -> C:\Temp\mvcApp\bin\Debug\net5.0\mvcApp.Views.dll
C:\Program Files\dotnet\sdk\5.0.300\Sdks\Microsoft.NET.Sdk.Publish\targets\CopyTargets\Microsoft.NET.Sdk.Publish.CopyFiles.targets(80,5): error MSB4006: There is a circular dependency in the target dependency graph involving target "Publish". Since "_CopyAspNetCoreFilesToIntermediateOutputPath" has "DependsOn" dependence on "Publish", the circular is "Publish<-_CopyAspNetCoreFilesToIntermediateOutputPath<-CorePublish<-DotNetPublish<-_PublishBuildAlternative<-Publish". [C:\Temp\mvcApp\mvcApp.csproj]

This seems to be similar to dotnet/sdk#16474 but I'm not using Visual Studio. dotnet clean doesn't seem to help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExternalThis is an issue in a component not contained in this repository. It is open for tracking purposes.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions