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

查看:6
本文介绍了如何查询 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天全站免登陆