Bug 38224 - Microsoft.Build.Evaluation.Project(string name) initialization error
Summary: Microsoft.Build.Evaluation.Project(string name) initialization error
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: Ms.Build (show other bugs)
Version: master
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2016-01-30 23:08 UTC by Avenger
Modified: 2016-01-30 23:11 UTC (History)
1 user (show)

See Also:
Is this bug a regression?: ---
Last known good build:


Description Avenger 2016-01-30 23:08:18 UTC
Hello, this is a pretty straightforward bug that I think you may fix it in a tad.

On .NET 4.0, at least, we can use the following program:
var projectFile = "../../ListCompileFiles.csproj";
var projectInfo = new Project(projectFile);
Console.WriteLine("'Compile' items list: ");
foreach (var item in projectInfo.Items)
    if (item.ItemType == "Compile")
        Console.WriteLine("Compile item: " + item.EvaluatedInclude);

Console.WriteLine("Listing complete. Total " + projectInfo.Items.Count() + " entries.");

On Mono though, it will not work, showing always 0 projectInfo.Items.

If we change line 2 to:
var projectInfo = new Project(XmlReader.Create(projectFile));

Then the code works just fine on both platforms!


Should use XmlReader.Create() instead of ProjectRootElement.Create() (which it uses with the result of XmlReader.Create()!.

A pull request on mono/mono github repo will follow this bug entry.
Comment 1 Avenger 2016-01-30 23:11:43 UTC
The pull request proposing a fix for this issue is:


I hope it helps! :)

Note You need to log in before you can comment on or make changes to this bug.