Import added does not appear in the Imports collection (Msbuild Project)

Posted by sebastian on Stack Overflow See other posts from Stack Overflow or by sebastian
Published on 2009-07-31T15:31:48Z Indexed on 2010/04/15 16:53 UTC
Read the original article Hit count: 326

The title pretty much says it all...

this code does not write anything to the console cause the collection is empty.

Project p = new Project(engine);
p.AddNewImport(@"C:\mytarget.targets","");
foreach(Import imp in p.Imports)
    Console.WriteLine(p.ProjectPath);

But!, if I debug the code the collections get the imports, I guess it has to do with timming? :(

© Stack Overflow or respective owner

Related posts about msbuild

Related posts about microsoft.build