简体   繁体   English

在以下位置构建x86和x64

[英]Build both x86 and x64 at

I need to build some application in two configurations: x86 and x64 (each config has reference on some dll, which is in 32 and 64 bit versions). 我需要用两种配置来构建一些应用程序:x86和x64(每个配置在32和64位版本的dll上都有引用)。 I want to build in some time(one build) and as result i want to have two folders,ie: 1) sln_dir/x86/ 2) sln_dir/x64/ 我想在一段时间内构建(一个构建),因此我想拥有两个文件夹,即:1)sln_dir / x86 / 2)sln_dir / x64 /

Also x86 contains 32 bit dll and x64 contains 64 bit dll. 此外,x86包含32位dll,而x64包含64位dll。 Is it possible?And if it is possible how? 有可能吗? Thanks! 谢谢!

Well, I'd add new project configurations, and set the build type for each configuration, along with the output directory. 好吧,我将添加新的项目配置,并为每个配置以及输出目录设置构建类型。 So you might have "Debug x86" and "Debug x64" project configurations, with output directories of "bin\\DebugX86" and "bin\\DebugX64" for example. 因此,您可能具有“ Debug x86”和“ Debug x64”项目配置,例如,输出目录为“ bin \\ DebugX86”和“ bin \\ DebugX64”。

That's a change that can even be done within Visual Studio, unlike most of the project file hacks I perpetrate :) 这是一个更改,甚至可以在Visual Studio中完成,这与我执行的大多数项目文件黑客不同:)

That won't build configurations with a single "build project" button press, but: 按下一个“ build project”按钮不会建立配置,但是:

  • You could add a post-build step for one configuration to build the other 您可以为一种配置添加构建后步骤,以构建另一种配置
  • If this is only relevant when you build the Wix installer, I'd just script the building of that to first build both configurations 如果仅在构建Wix安装程序时才有意义,那么我只需要编写脚本以首先构建两个配置

Another Visual Studio feature you should look at is the "Batch Build" option. 您应该查看的另一个Visual Studio功能是“批处理生成”选项。 Unfortunately it doesn't look like there's a way of saving a batch build to perform it multiple times easily :( 不幸的是,似乎没有一种方法可以保存批处理构建以轻松地多次执行:(

You can: 您可以:

1) Create 2 different projects with different target CPU architecture and build solution. 1)创建具有不同目标CPU架构的2个不同项目并构建解决方案。

Solution 
      ProjectA x86 
      ProjectB x64 

Build solution. 构建解决方案。 Both projects are pointing to the same source code files, naturally. 很自然,两个项目都指向相同的源代码文件。 There is no any source copy. 没有任何源副本。

2) You can create external batch build with code like (example) 2)您可以使用以下示例代码创建外部批处理版本

"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" 
         "PATH TO SOLUTION" /Rebuild "CONFIG NAME"

Where 哪里

  • "PATH TO SOLUTION" is a path to your solution file “解决方案的路径”是您解决方案文件的路径
  • "CONFIG NAME" is a configuration name, like Release86 or Relese64 . “ CONFIG NAME”是一个配置名称,例如Release86Relese64

    Write there code for every confifguration you need (those configuration have to be already configured in visual studio before). 为您需要的每个配置编写代码(之前必须已经在Visual Studio中配置了这些配置)。 And just run that batch ones. 并运行该批处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM