Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The item "Class1.cs" was specified more than once in the "Sources" parameter #668

Closed
aL3891 opened this issue Jan 17, 2017 · 9 comments
Closed
Assignees

Comments

@aL3891
Copy link

aL3891 commented Jan 17, 2017

Hello,
While reproing NuGet/Home#4059 I ran into a strange issue with the latest cli, all the details are over there but basically, for a previously created class library I get

    1>Target "_GenerateCompileDependencyCache" in file "C:\Program Files\dotnet\sdk\1.0.0-rc4-004527\Microsoft.Common.CurrentVersion.targets" from project "C:\Users\Allan\Documents\Visual Studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj" (target "Compile" depends on it):
       Added Item(s): CustomAdditionalCompileInputs=obj\Debug\netstandard1.6\CoreCompileInputs.cache
       Added Item(s): 
           CoreCompileCache=
               C:\Users\Allan\Documents\Visual Studio 2017\Projects\ClassLibrary1\ClassLibrary1\Class1.cs
               C:\Users\Allan\Documents\Visual Studio 2017\Projects\ClassLibrary1\ClassLibrary1\Class1.cs
               C:\Users\Allan\AppData\Local\Temp\.NETStandard,Version=v1.6.AssemblyAttributes.cs
       Added Item(s):  ...

and then

       (CoreCompile target) -> 
         C:\Program Files\dotnet\sdk\1.0.0-rc4-004527\Roslyn\Microsoft.CSharp.Core.targets(71,5): error MSB3105: The item "Class1.cs" was specified more than once in the "Sources" parameter.  Duplicate items are not supported by the "Sources" parameter. [C:\Users\Allan\Documents\Visual Studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj]

Even though there is only one cs file in that project. Am I missing something obvious?

@aL3891
Copy link
Author

aL3891 commented Jan 17, 2017

ah, removing

  <ItemGroup>
    <Compile Include="**\*.cs" />
  </ItemGroup>

fixes the issue.

still, feels like this should be handled somehow or a lot of projects are going to break :)

@dsplaisted dsplaisted self-assigned this Jan 17, 2017
@dsplaisted
Copy link
Member

There is supposed to be a different error message that tells you that you don't need the Compile include in your file. It's not showing up in the intellisense build: #664

@dsplaisted
Copy link
Member

Thinking more about it, it's possible that the reason you didn't get the right error message is because the CLI you are using doesn't have the changes from #624 which added it.

@aL3891
Copy link
Author

aL3891 commented Jan 18, 2017

Aha allright, that's what living on the edge gets ya :D
no worries, just wanted to make you aware of it :)

@aL3891 aL3891 closed this as completed Jan 18, 2017
@enricforn
Copy link

@aL38891 which version of sdk contains the fix to this issue ?

@dsplaisted if I remove these lines, Visual Studio 2017 do not recognize the class as added to the project

@aL3891
Copy link
Author

aL3891 commented Jan 22, 2017

i'm using version 1.0.0-preview4-004233

@dsplaisted
Copy link
Member

@dsplaisted if I remove these lines, Visual Studio 2017 do not recognize the class as added to the project

@enricforn We haven't released a version of Visual Studio with these changes yet. So right now what your .NET CLI supports and what your version of Visual Studio supports is out of sync.

@enricforn
Copy link

@dsplaisted ok, as a workaround we'll only compile through command line. It will be supported on the next RC ?

@bangonkali
Copy link

After removing all occurrences of

<Compile Include="**\*.cs" />

it works on VS 2017 RC3.

Then I also installed the following debs on our Linux Ubuntu Server so that it can build from the Linux Server:

https://dotnetcli.blob.core.windows.net/dotnet/preview/Installers/Latest/dotnet-host-ubuntu-x64.latest.deb
https://dotnetcli.blob.core.windows.net/dotnet/preview/Installers/Latest/dotnet-hostfxr-ubuntu-x64.latest.deb
https://dotnetcli.blob.core.windows.net/dotnet/preview/Installers/Latest/dotnet-sharedframework-ubuntu-x64.latest.deb
https://dotnetcli.blob.core.windows.net/dotnet/Sdk/rel-1.0.0/dotnet-sdk-ubuntu-x64.latest.deb

I used this call

wget https://dotnetcli.blob.core.windows.net/dotnet/preview/Installers/Latest/dotnet-host-ubuntu-x64.latest.deb && \
wget https://dotnetcli.blob.core.windows.net/dotnet/preview/Installers/Latest/dotnet-hostfxr-ubuntu-x64.latest.deb && \
wget https://dotnetcli.blob.core.windows.net/dotnet/preview/Installers/Latest/dotnet-sharedframework-ubuntu-x64.latest.deb && \
wget https://dotnetcli.blob.core.windows.net/dotnet/Sdk/rel-1.0.0/dotnet-sdk-ubuntu-x64.latest.deb && \
sudo dpkg -i "dotnet-host-ubuntu-x64.latest.deb" && sudo apt-get install -f && \
sudo dpkg -i "dotnet-hostfxr-ubuntu-x64.latest.deb" && sudo apt-get install -f && \
sudo dpkg -i "dotnet-sharedframework-ubuntu-x64.latest.deb" && sudo apt-get install -f && \
sudo dpkg -i "dotnet-sdk-ubuntu-x64.latest.deb" && sudo apt-get install -f

mmitche pushed a commit to mmitche/sdk that referenced this issue Jun 5, 2020
…0190529.8 (dotnet#668)

- Microsoft.AspNetCore.Mvc.Api.Analyzers - 3.0.0-preview6-19279-08
- Microsoft.AspNetCore.Mvc.Analyzers - 3.0.0-preview6-19279-08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants