Hello.
Is there any way to ask msbuild what build targets provided msbuild file support? If there is no way to do it in command prompt, may by it's possible programmaticly?
Are there no way to do it besides parsing msbuild XML?
Hello.
Is there any way to ask msbuild what build targets provided msbuild file support? If there is no way to do it in command prompt, may by it's possible programmaticly?
Are there no way to do it besides parsing msbuild XML?
Certainly MS provides the api to do this without parsing the xml yourself. Look up microsoft.build.buildengine
Adapted from some C# code found on msdn ... it's usually worth exploring. Need to reference the microsoft.build.engine dll for this to compile. Replace framework version and path below with your values. This worked on a sample project file, although the list may be longer than you expect.
using System;
using Microsoft.Build.BuildEngine;
class MyTargets
{
static void Main(string[] args)
{
Engine.GlobalEngine.BinPath = @"C:\Windows\Microsoft.NET\Framework\v2.0.NNNNN";
Project project = new Project();
project.Load(@"c:\path\to\my\project.proj");
foreach (Target target in project.Targets)
{
Console.WriteLine("{0}", target.Name);
}
}
}