Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 878
Adam Avatar asked Dec 04 '15 16:12

Adam


1 Answers

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())
like image 159
Dbl Avatar answered Oct 21 '22 15:10

Dbl