在 Visual Studio 2010SDK 中使用 EnvDTE 库 - 构建模式和二进制路径(?)

发布于 2024-09-13 11:03:44 字数 550 浏览 2 评论 0原文

我正在开发一个小程序,旨在修改我的主要顶级应用程序二进制文件构建后。为了完全自动化该过程,我需要获取二进制文件的有效路径,例如../debug/application.exe 或../release/application.exe。

我的问题是,我需要独立于构建模式获取二进制路径。虽然我的项目可以构建为发布版本或调试版本,但我的 application.exe 路径需要无关紧要。

所以我发现我实际上可以使用 Visual Studio 2010 SDK 以编程方式获取有效路径。我只需要获取用户在 IDE 中设置的配置值;例如发布和调试模式及其正确的binary.exe路径并对其进行编码。

VS2010SDK 中有一个库可以使之成为可能。它运行在可以操作整个自动化模型的DTE对象上。我对 Visual Studio 2010 的 SDK 部分相当缺乏经验,我可以使用一两个技巧;一个为我指明从哪里开始挖掘的人。

你能帮我解决这个问题吗?

我选择的 IDE 显然是 Visual Studio 2010,项目本身是用 C# 4 编写的。

祝你一切顺利,

Pawel

I am working on a small program which aims to modify my main, top-level application binary file post-build. In order to fully automate the process, I need to obtain a valid path to the binary, e. g. ../debug/application.exe or ../release/application.exe.

My problem is, that I need to get the binary path independently of the build mode. While my project can be built as a release or debug version, my path to application.exe needs to be irrelevant.

So I found out that I actually can obtain the vaild path programmaticaly, with the use of Visual Studio 2010 SDK. I just need to get configuration values set by user within the IDE; e. g. release and debug mode and it's proper binary.exe path and code them.

There's a library found in VS2010SDK which can make it possible. It operates on DTE object which can manipulate automation model as a whole. I'm rather unexperienced in SDK part of Visual Studio 2010, I could use a tip or two; a person who points me the way where to start digging.

Could you possibly help me with this?

My IDE of choice is obviously Visual Studio 2010 and project itself is written in C# 4.

I wish you all best,

Pawel

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深者入戏 2024-09-20 11:03:44

安装 DxCore 并在互联网搜索中使用术语“EnvDTE”。例如,要发现处理解决方案的 API 调用,请在您最喜欢的搜索引擎中搜索“EnvDTE 解决方案”。

以下是一些示例代码,展示了如何确定目标构建以及如何切换到“发布”构建:

// switch the configuration to "release"
EnvDTE.Solution solution = CodeRush.Solution.Active;

if (solution.SolutionBuild.ActiveConfiguration.Name != "Release")
{
    solution.SolutionBuild.SolutionConfigurations.Item("Release").Activate();
}

Install DxCore and use the term "EnvDTE" in your internet searches. For example, to discover API calls dealing with solutions, search "EnvDTE solutions" in your favorite search engine.

Here's some sample code that shows how to determine which build is being targeted and how to switch to the "release" build:

// switch the configuration to "release"
EnvDTE.Solution solution = CodeRush.Solution.Active;

if (solution.SolutionBuild.ActiveConfiguration.Name != "Release")
{
    solution.SolutionBuild.SolutionConfigurations.Item("Release").Activate();
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文