Edit

Share via


MSB3577: Two output file names resolved to the same output path: "path"

This error indicates that there is a duplicate filename in the build output.

If you need more information to diagnose the error, first enable a diagnostic log (use the -verbosity:diag command-line switch), and check the MSBuild log file with the full diagnostics output. For bigger output logs on large projects, consider using the binary log (-bl command-line switch) and the MSBuild Structured Log Viewer to view the output more easily.

Check the file in question and try to determine why it's being generated more than once - what are the build processes that are creating it? Can you rename one of the two files? Is there a duplicate step in the build process, so the same file is being generated more than once?

This error occurs with resource files, especially in Visual Basic Windows Forms projects. You can edit your project file to specify ManifestResourceName metadata, which will help the GenerateResource task create a unique filename for each resource file. A simple example is shown in the following code:

<EmbeddedResource Include="MyResources.resx">
  <ManifestResourceName>CustomName</ManifestResourceName>
</EmbeddedResource>

You must ensure that the value given for CustomName is different for each generated resource file.

In MSBuild 16.10 and later, you can use TargetPath metadata to disambiguate the duplicated path names.

<Content Include="Files\**">
  <Link>Files\%(Filename)%(Extension)</Link>
  <TargetPath>%(Filename)%(Extension)</TargetPath>
  <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

No extension needs to be added; the extension .resources is automatically applied.