Visual Studio 2015: An equivalent project is already present in the project collection
Asked Answered
S

12

14

When attempting to add back existing projects to a Visual Studio 2015 solution, VS gives the following error message. I have verified I have not already added a reference to the project I am trying to add. Is there a settings or cache file I need to delete or cleanup somewhere?

An equivalent project (a project with the same global properties and tools version) is already present in the project collection, with the path "D:\My\Path\MyProject.csproj". To load an equivalent into this project collection, unload this project first.

Sullivan answered 4/12, 2015 at 16:26 Comment(0)
S
0

Still not sure what causes this to happen but it seems adding the dependent projects in reverse order allowed me to add all of my projects back in. So add all child projects first and then add the parent projects they depend on. The order they were added back into the solution may have caused the flakiness.

Sullivan answered 4/12, 2015 at 16:28 Comment(0)
S
16

Simply "Clean Solution" worked for me.

Selfdenial answered 1/6, 2016 at 9:52 Comment(4)
I had to do this, and also restart Visual Studio. OddMosstrooper
Clean, then force reload of the project (right click) worked for me. I also sacrificed a small stuffed animal , so that may have helped.Chiquita
Manual clean (Deleting all bin / obj folders manually from the solution) worked for meCher
Clean itself did not work, cleaning the workspace with tf reconcile /clean /recursive . itself did not work either. I had to exit Visual Studio and restart in addition to fix the issue.Roethke
I
9

This happened to me after messing around with my project files with an external editor. I was able to solve the problem by exiting from VS and also killing, VsHub.exe.

It seems that VsHub.exe caches some portion of the project and becomes confused or out-of-sync with VS.

Impervious answered 2/2, 2017 at 19:16 Comment(1)
Thanks. It was complaining that a .filters file had conflicting references but that .filters file did not exist.Circlet
D
6

I invoked it through code.

This fixed it for me:

Microsoft.Build.Evaluation.ProjectCollection.GlobalProjectCollection.LoadedProjects.FirstOrDefault(d => d.FullPath == projectFilePath) ??
                Microsoft.Build.Evaluation.Project.FromFile(projectFilePath, new ProjectOptions())
Delacroix answered 28/12, 2018 at 21:35 Comment(0)
B
2

This link provided me with a simple prophylactic, one much less drastic than running {VSpath}\devenv.exe /resetuserdata

I found that by adding a Filter to the project (even though I didn't particularly need one) I could force VS2015 to create a .vcxproj.filters file. Once in place, I stopped seeing the problem.

BTW, in my case the problem was triggered by unloading the project, making tricky changes in the .vcxproj file (stuff involving [MSBuild] arithmetic on property values), then trying to reload the project, and having that fail due to syntax errors. Fixing the errors, removing/re-adding the project, etc. did not work. The 'already present' bug persisted.

Backlog answered 7/4, 2016 at 22:30 Comment(0)
I
1

I get this frequently when switching branches with git. I find that if I "touch ZFSin.vcxproj.filters" - (the projects filters file) I can then right-click the failed-to-load project and "reload". No Clean-project, nor restart VS2017. (Touch is a command that just updates the timestamps on a file).

Induplicate answered 17/1, 2019 at 7:5 Comment(0)
S
1

In my case, the project only had a x64 platform configuration, not a Win32 platform configuration. Strangely enough the solution did have the Win32 platform configuration and for some reason Win32 was the current platform configuration.

After changing to x64 I could load the project again without problems. I also removed the Win32 platform configuration just to make sure.

Shwa answered 27/6, 2019 at 14:54 Comment(0)
S
0

Still not sure what causes this to happen but it seems adding the dependent projects in reverse order allowed me to add all of my projects back in. So add all child projects first and then add the parent projects they depend on. The order they were added back into the solution may have caused the flakiness.

Sullivan answered 4/12, 2015 at 16:28 Comment(0)
C
0

This happened to me after a bluescreen. The following seemed to fix it:

  1. Start VS2015 cmd prompt.
  2. Run "devenv /resetuserdata"
Concatenation answered 4/1, 2016 at 21:36 Comment(4)
Careful! This is a rather drastic approach, because it will reset all your Visual Studio settings including any AddIns you may have installed.Roethke
OMG what did I just do?!?Burier
This worked, but also deleted all my plugins and custom settings. I wish VS didn't try to cache so many things in so many hidden places.Morehead
I've had to do this twice now in the past week when trying to upgrade a project from Framework to Standard. A project that depends on the upgraded project will give this error until I delete my user cache. Deleting the .vs folder, rebooting, cleaning solution, and manually deleting bin and obj folders did nothing in my case.Morehead
M
0

Windows reboot fixed this problem for me. After reboot Visual Studio does not show such strange error message.

Marbut answered 9/2, 2016 at 7:54 Comment(0)
K
0

In my case I saw this error when I was doing the following:

I was including/importing 3.vcxproj inside 2.vcxproj and 2.vcxproj was included inside 1.vcxproj.

The path to 3.vcxproj inside 2.vcxproj was wrong and that gave me above error.

Corrected the path and error went away. Not sure how filters are related.

Karolyn answered 14/7, 2016 at 11:46 Comment(0)
U
0

I had this problem when the solution was using environment variables in project paths and other paths. I think it was expecting to find %var1%\proj.vcxproj and %var2%\proj.vcxproj , but %var1% and %var2% had the same value.

Unimposing answered 5/3, 2019 at 0:8 Comment(0)
S
0

This is occurring in VS 2022 as well. None of the solutions posted here worked in my case.

The fix for me: Delete the profile and create a new profile. {PROJECT_DIR}\Properties\PublishProfile\{YOUR_PROFILE}

Silber answered 26/10, 2022 at 13:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.