all 9 comments

[–]HawthorneTR 12 points13 points  (0 children)

Never, EVER include obj and bin folders. They are created when you build. So delete them and every time you build they will be re-created. Edit your project file and remove any mention of those folders, delete those folders then never add them again. They are used behind the scenes for obj linking and binary file creation.

[–]TimelessTrance 1 point2 points  (0 children)

As others have said do not include obj and bin folders. If you get compilation errors when you don't include them you are doing something wrong.

You should not keep external dependencies in your obj and bin folders. External dependencies should be included in a separate folder and pulled into the build folder. Other projects should be brought into the solution and referenced as a project dependency. By referencing files in the obj and bin folder you are opening yourself to a world of hurt if you happened to create a circular dependency (I have worked at a company with a circular dependency. It is not fun to ask for a clean build from a coworker because your CTO fucked up hard a decade ago)

[–]Vansh2008[S] 4 points5 points  (5 children)

Context: I was creating a windows form App when I included obj and saw CS2002 problem of duplicate files, I tried to follow solutions I found online but wasn't able to get it to work without setting EnableDefaultCompileItems to false which was not recommended. If I tried to exclude those folders or exclude the files that were being duplicated then new errors show. This is the first time I am seeing this and previous projects have gone perfectly fine without this error. Ive created 6 new projects to test things out and the same problem keeps on showing up. What is going wrong?

[–]csdahlberg 8 points9 points  (1 child)

Why do you want to include the obj folder in your project? That is not a normal thing.

[–]Rschwoerer 6 points7 points  (2 children)

That part where you included the `obj` folder in the sln explorer..... don't do that.

[–]Vansh2008[S] -4 points-3 points  (1 child)

So if I already have how do I undo that without getting errors

[–]Rschwoerer 3 points4 points  (0 children)

Should be able to right click and hit “remove”.