Are msbuild parsers available?

I am looking for an MSbuild parser. Currently, I have written my own, which is not complete ... but I feel like I am reinventing the wheel, creating something that certainly already exists.

+2
source share
2 answers

Some information I found here ... http://social.msdn.microsoft.com/Forums/en/msbuild/thread/b3db4d7c-b7d1-4958-9145-bfd34cc75320

In addition, there are small projects with some high-level samples: http://code.msdn.microsoft.com/msbuildho

using Microsoft.Build.Construction; using Microsoft.Build.Evaluation; using System.Linq; class Program { static void Main(string[] args) { Project testProj = new Project(); testProj.Xml.AddTarget("BuildProjects"); foreach (ProjectTargetElement pti in testProj.Xml.Targets.Where(pti => pti.Name == "BuildProjects")) { pti.AddTask("MSBuild"); } testProj.Save(@"C:\testProj.proj"); } } 
+1
source

Microsoft.Build.Construction.XXX in microsoft.build.dll (version 4.0+) is a raw MSBuild file parser. It is powerful and complete and similar to the XML DOM. It works with a single file without making ratings. This is useful, for example, when you want to run a script on a project tree in order to somehow edit them, perhaps to add a general import statement.

Microsoft.Build.Evaluation.XXX works with evaluated projects, that is, with all evaluated properties, imported files, etc. It is useful in a development environment - you can read files and properties in a project, add new files, etc. Visual Studio uses it for this purpose.

Prior to version 4.0, a completely different, much more limited and less complete object model appeared in microsoft.build.engine.dll. It still comes with 4.0, but cannot handle 4.0 syntax. He is out of date.

I designed and implemented them, so I would be interested to get feedback if you have any.

+5
source

Source: https://habr.com/ru/post/1444557/


All Articles