Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS2017: CSC : warning CS2002: Source file <filename> specified multiple times. How to fix?

I just downloaded the new Visual Studio 2017 RTM and am using it to compile a Windows Library. I used VS2017 to create the new Windows Library project, then I copied into the folder all my code files and used VS to include them in the project. I added some necessary nuget packages and then compiled it.

I received the following warnings but he compile completed successfully.

 1>------ Rebuild All started: Project: MP_Prim, Configuration: Debug Any CPU ------
 1>CSC : warning CS2002: Source file 'obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs' specified multiple times
 1>CSC : warning CS2002: Source file 'obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs' specified multiple times
 1>CSC : warning CS2002: Source file 'obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs' specified multiple times
 1>  MP_Prim -> c:\users\ron clabo\documents\visual studio 2017\Projects\wwwGiftOasisResponsive\MP_Prim\bin\Debug\MP_Prim.dll
 ========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

I'd like to make these warning go away. I researched the warning online but the info I found wasn't very helpful. The help amounted to "Remove redundant file specifiers." I could have guessed that myself based on the error.

But where is the redundant source file being specified? And based on the file name in the warning it's an auto generated file, so why is this auto generated file being fed to the compiler multiple times? And where is that being specified. In short, how can I fix this and make the warning away?

like image 788
RonC Avatar asked Mar 09 '17 15:03

RonC


1 Answers

I don't know if you solved it yet, but I had the same error.

I just went to the obj/Debug folder right click and select Exclude from Project

That worked just fine for me. I didn't want to simply delete the files because I don't know what they are.

like image 118
sjfries Avatar answered Sep 18 '22 08:09

sjfries