question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

error MSB3105: The item "XXX.cs" was specified more than once in the "Sources" parameter.

See original GitHub issue

While trying to build this PR https://github.com/Microsoft/Docker.DotNet/pull/144 for some reason it is thinking I have a duplicated file in the CI build at AppVeyor.

C:\Program Files\dotnet\sdk\1.0.0-preview5-004460\Roslyn\Microsoft.CSharp.Core.targets(71,5): error MSB3105: The item "AnonymousCredentials.cs" was specified more than once in the "Sources" parameter.  Duplicate items are not supported by the "Sources" parameter. [C:\projects\docker-dotnet\Docker.DotNet\Docker.DotNet.csproj]

1.0.0-preview5-004232 build it just fine. However, the latest version 1.0.0-preview5-004460 throw this error for the same project…

Any ideas?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:17 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
stevescotcommented, May 10, 2017

In my case this was a problem as the .csproj.user file had a reference in it as well as the .csproj - so have a look in both files - if it exists in both this can cause the problem

1reaction
eerhardtcommented, Jan 9, 2017

The latest SDK adds all .cs files by default now without any “Compile” lines.

To fix the error either:

  1. Remove all “Compile” elements from your .csproj and let the SDK add all .cs files to your project automatically. See https://github.com/dotnet/sdk/blob/master/src/Templates/ProjectTemplates/CSharp/.NETCore/CSharpConsoleApplication/ProjectTemplate.csproj for the latest .csproj console app template. Or https://github.com/dotnet/sdk/blob/master/src/Templates/ProjectTemplates/CSharp/.NETCore/CSharpClassLibrary/ProjectTemplate.csproj for the latest class library template for examples.
  2. If you want to control which files are added and don’t want the SDK to automatically added them, set <EnableDefaultItems>false</EnableDefaultItems> property in your .csproj.

This experience will get better once #600 is fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

visual studio 2010 - error in csproj - duplicate item
The item "MyNewClass.cs" was specified more than once in the "Sources" parameter. Duplicate items are not supported by the "Sources" parameter.
Read more >
The item was specified more than once in the sources parameter
The Item "C:\PathToproject\obj\CodeGen\MVC\Views\CustomWidgetName\default.cshtml.cs" was specified more than once in the "Sources" parameter
Read more >
Error in csproj – duplicate item
I have error from visual studio 2010: Error 1 The item "CrossDomainService.svc.cs" was specified more than once in the "Sources" parameter.
Read more >
The item \xxx\yyy.cs“ was specified more than once
I have following error : The item \xxx\yyy.cs“ was specified more than once in the ”Sources“ parameter. Duplicate items are not supported by ......
Read more >
Resource error !Duplicate items are not supported by the " ...
admin.resources" was specified more than once in the "Resources" parameter. Duplicate items are not supported by the "Resources" parameter.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found