Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

Unload Project safely

$
0
0

I have this code for get imports of a project:

 var project1 = new Microsoft.Build.Evaluation.Project(project.FullName); 

bool contieneTargetsAux = false;            

project1.Xml.Imports.ForEach(i => {                
var contieneTargetsSharePoint = i.Project.ContainsWithStringComparison("Microsoft.VisualStudio.SharePoint.targets", StringComparison.InvariantCultureIgnoreCase);              

Trace.WriteLine("\t Import Project: " + i.Project);      

if (contieneTargetsSharePoint) contieneTargetsAux = true;            });            

contieneTargets = contieneTargetsAux;

I get this error:

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

Any suggestions?


www.kiquenet.com/profesional


Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>