如何查询MSBUILD文件以获取受支持目标的列表? [英] How to query MSBUILD file for list of supported targets?

查看:88
本文介绍了如何查询MSBUILD文件以获取受支持目标的列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何方法可以询问msbuild提供了哪些msbuild文件支持?如果无法在命令提示符下执行此操作?可以通过编程来完成吗?

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 be it could be done programmatically?

除了解析msbuild XML之外,还有其他方法吗?

Are there no way to do it besides parsing msbuild XML?

推荐答案

已为.NET Framework 4更新,因为上述内容已被弃用.导入microsoft.build.dll,代码如下:

Updated for .NET Framework 4, since the above has been deprecated. Import microsoft.build.dll and code is as follows:

using System;
using Microsoft.Build.Evaluation;
class MyTargets
{
  static void Main(string[] args)
  {
    Project project = new Project(args[0]);
    foreach (string target in project.Targets.Keys)
    {
      Console.WriteLine("{0}", target);
    }
  }
}

这篇关于如何查询MSBUILD文件以获取受支持目标的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆