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