蚂蚁-> 南特-> Visual Studio 2005 构建

发布于 2024-07-09 06:51:54 字数 428 浏览 8 评论 0原文

我正在开发一个大型 C++ 项目。 它是使用单个 Ant 脚本构建的,这使得可以针对多个平台和编译器编译相同的源代码。

但是,我只能在 Windows 平台和 Visual Studio 2005 C++ 编译器上工作。 如果我可以在 Visual Studio 中编写代码并进行编译,而不是像现在一样使用 Notepad++ 和 Ant 脚本,那就太好了。

我尝试为 Visual Studio 2005 安装 Nant 和 Nant 插件,并使用现有的 Ant 脚本,但似乎 Ant 脚本不能用作 Nant 脚本。

有什么办法可以将 Ant 脚本转换为 Nant 吗? 是否有任何其他方法可以解决该问题,或者我必须手动创建 Visual Studio 解决方案和项目?

我会尽量避免这样的解决方案,因为我有很多测试,我不知道在这种情况下如何使用。

I am working on a big C++ project. It is building using single Ant script which makes possible to compile the same source targeting more than one platform and compiler.

But, I have to work only for Windows platform and Visual Studio 2005 C++ compiler. It would be really nice if I could write code and compile in Visual Studio, instead of using Notepad++ and Ant scripts, as I do now.

I tried to install Nant and Nant addin for Visual Studio 2005, and to use existing Ant script, but it seems that Ant script cannot be used as a Nant script.

Is there any way to convert Ant script to Nant? Is any other approach to the problem at all, or I must create Visual Studio solution and projects manually?

I would try to avoid such solution because I have a bunch of tests that I don't know how to use in that case.

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

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

发布评论

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

评论(3

别挽留 2024-07-16 06:51:54

据我所知,没有自动方法将 Ant 脚本转换为 NAnt。 然而,由于 NAnt 是基于 Ant 的,只要任务是“核心”任务,转换过程就不会与原始过程相差太远。 可能可以对 Ant 脚本进行 XSLT 翻译以转换为 NAnt,因为两者都是 XML。 如果要走这条路,转换应该基于原始 Ant 脚本动态完成,这样就只需维护一组脚本。

如果您想在 Visual Studio 中编写和编译 C++ 代码,那么 IDE 内置的功能很难被超越。 但是,这需要创建项目文件。 否则,人们似乎会冒着与该工具进行一场艰苦战斗的风险。

测试的一种选择是通过 自定义调用构建步骤来运行它们。

To my knowledge, there is no automatic way of converting Ant script to NAnt. However, since NAnt is based off of the Ant the conversion process would not be too far from the original, as long as the tasks are the "core" ones. Possibly an XSLT translation could be made on the Ant scripts to convert to NAnt as both are XML. If one were to go down this path the conversion should be done dynamically based of the original Ant scripts, so that only one set of scripts would have to be maintained.

If you would like to write and compile your C++ code inside of Visual Studio it's tough to beat the functionality that is built in with the IDE. However, this requires creating project files though. Otherwise, it seems that one would risk fighting an uphill battle with the tool.

One option for the tests would be to call out through a custom build step to run them.

深海不蓝 2024-07-16 06:51:54

根据我的经验,将 VS 与 ant 集成的最佳方法是在 IDE 端调用 ant 作为自定义构建步骤(如 Scott Saad 建议的那样),并从 ant 调用 msbuild.exe 作为可执行文件来构建项目命令行。

我知道这个问题已经得到解答——我只是想建议使用 msbuild 的可能性,因为它是迄今为止从 ant 本身构建 VS 项目的最简单方法。

In my experience, the best way to integrate VS with ant is on the IDE side to call ant as a custom build step (as Scott Saad suggests), and from ant, to call msbuild.exe as the executable to build the project from the command line.

I know that this question is already answered -- I just wanted to suggest the possibility of using msbuild, as it's by far the easiest way to build VS projects from within ant itself.

我早已燃尽 2024-07-16 06:51:54

使用包含在 NAnt 任务中的 MSBuild 任务。 我在上一份工作中必须这样做,这是我能想到的最好的解决方案,但我可能会变得非常糟糕。

Use MSBuild tasks wrapped within an NAnt task. I had to do this at my last job and it was the best solution I could come up with, then again I could just be very bad.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文