Skip to main content

error NETSDK1152: Found multiple publish output files with the same relative path

Symptoms​

When publishing a project locally, or using DevOps, you may see an error:

\${NL}error NETSDK1152: Found multiple publish output files with the same relative path \${NL}

Cause​

This error seems to be generated by the SDK when MSBuild detects duplicate files in the publish output but cannot figure out which file to keep (new to .NET 6).

Resolution​

Unsure of the fulle fix but there is a workaround. The newly introduced **`ErrorOnDuplicatePublishOutputFiles **tells the build process not to generate the error.

Add to the Project file that is failing as follows:

You may need to add this to dependent projects as well (e.g. integration/unit tests).