VS2010 中一个项目有多个构建配置?

发布于 2024-09-14 02:11:00 字数 202 浏览 0 评论 0原文

我有 ac# windows 应用程序项目。我想构建两个 .exe 文件,一个在 64 位操作系统上作为 64 位运行(通过针对“任何 CPU”的平台),另一个在 64 位操作系统上作为 32 位运行(通过针对 x86 的平台)。

目前,每当我需要其他配置时,我都应该更改构建配置,并重命名编译文件以区分 32 和 64。

是否有更简单的方法来管理多个配置?

I have a c# windows application project. I want to build two .exe files, one is run as 64bit on 64 bit OS (by platform targeting 'Any CPU'), the other is run as 32 bit on 64 bit OS (by platform targeting x86).

Currently, I should change my build configuration whenever i need the other configuration, and rename the compiled file to distinguish between 32 and 64.

Is there an easier way to manage multiple configurations?

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

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

发布评论

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

评论(2

蒗幽 2024-09-21 02:11:00

创建 32 位构建和 64 位构建。
这将允许您将它们放在不同的文件夹中。

右键单击解决方案,选择“配置管理器”
在活动解决方案配置中选择“新建”
称之为 32 位构建
在 CPU 下拉列表中选择 32 位选项。

重复并将其命名为 64 位构建。

现在,当您进行构建时,它将转到 C:\Development\ProjectName\Bin\32-Bit Build\programname.exe
或类似的 64 位

Create a 32 bit build and 64 bit build.
This will allow you to have them put in different folders.

Right click on the solution, choose "Configuration Manager"
In the Active Solution Configuration choose "new"
Call it 32-Bit Build
Pick the 32 bit option in the CPU dropdown.

Repeat and name it 64-Bit build.

Now when you do a build it will go to C:\Development\ProjectName\Bin\32-Bit Build\programname.exe
or similarly for 64 bit

不离久伴 2024-09-21 02:11:00

您可以使用批处理文件来构建项目。该文件将使用 MSBuild 并将目标平台作为参数传递。 property 属性如下所示:

Properties="Configuration=Debug;Platform=Any CPU"

Properties="Configuration=Debug;Platform=x86"

看一下几个示例

MSBuild 任务配置属性
MSBuild:为子构建指定平台时出现问题

有关 MSBuild 教程,请参阅 MSBuild 教程

You can use a batch file to build the project. The file will use MSBuild and pass the target platform as a parameter. The property attribute will look like:

Properties="Configuration=Debug;Platform=Any CPU"

Properties="Configuration=Debug;Platform=x86"

Take a look at a few samples

MSBuild task configuration property
MSBuild: Problems specifying platform for child builds

For MSBuild tutorial, see MSBuild Tutorials

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