Visual Studio中:如何正确建立和指定的配置和平台,x64和x86 [英] Visual Studio: How to properly build and specify the configurations and platforms for x64 and x86

查看:6238
本文介绍了Visual Studio中:如何正确建立和指定的配置和平台,x64和x86的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用:的Visual Studio 2012专业版和旗舰版的所有最新的更新

Using: Visual Studio 2012 Professional and Ultimate with all latest updates

我如何正确指定配置和平台,以正确构建x86和x64。

How do I properly specify the configuration and platform to properly build x86 and x64.

Visual Studio中,当你第一次创建一个WinForms应用程序为您提供了两种配置,调试和发布,定义为平台值为anycpu。

Visual Studio, when you first create a Winforms application gives you two configurations, Debug and Release, with AnyCPU defined as the platform.

如果你只是针对一个平台,那么答案很简单,你去建设|配置管理器,然后选择一个平台,然后去项目属性构建页面,并选择同一平台(x86或x64),瞧!你风与(说你要86)

If you just target one platform, then the answer is easy, you go to the Build | Configuration Manager and select one of the platforms and then go to the project properties' build page and select the same platform (x86 or x64) and voila! You wind up with (say you want x86)

/bin/x86/Debug
/bin/x86/Release

我有一个应用程序和多个相关项目(DLL组件)。

I have a solution with one application and multiple dependency projects (DLL assemblies).

由于VS配置管理器在顶部,配置和平台两个下拉列表,然后在项目级别的其他配置和平台,我做了以下内容:

Since the VS Configuration Manager has two dropdown lists at the top, Configuration and Platform and then on the project level another configuration and platform, I did the following:

(前进一步打字,我觉得整个安装很烂,但是......)

(Before typing further, I think the whole setup sucks, but...)

我创建了两个新的配置Debug64和Release64使用最上面的下拉列表,并选择混合平台的平台。

I created two new configurations Debug64 and Release64 using the top most dropdown and selected Mixed Platforms for the platform.

我选择的每个轮流四个主要的解决方案配置,然后设置项目级别的配置和项目级平台相匹配,因此:

I selected each of the four main solution configurations in turn and then set the project level configuration and project level platform to match, so:

Debug64 === Debug64, x64
Release64 === Release64, x64
Debug === Debug, x86
Release === Release, x86

然后我走进项目属性(Alt + Enter键)建立页面,忽略了平台和选择的每个配置反过来,然后设置目标处理器相匹配。我改为以下的输出:

I then went into the project properties (Alt + Enter) build page, ignored the platform and selected each configuration in turn and then set the target processor to match. I changed the output to be the following:

Debug64: /bin/x64/Debug
Release64: /bin/x64/Release
Debug: /bin/x86/Debug
Release: /bin/x86/Release

默认情况下,Visual Studio中使用的顶部平台,将文件夹和配置名称来设置输出的最后部分。如果我保存并关闭项目属性出来,然后一切似乎罚款。我可以建立,以及风与适当的文件夹。

By default, Visual Studio uses the top platform to set the folder and the configuration name to set the last part of the output. If I save and close out of the project properties, then all seems fine. I can build, and wind up with the proper folders.

问题来了,当我切换解决方案配置的Visual Studio工具栏上。该项目属性构建页面恢复到它想要什么在默认情况下,即,比如说,/斌/ 64 / Debug64为调试与类似的版本什么的。

The problem comes, when I switch solution configurations on the Visual Studio toolbar. The project properties build page reverts back to what it wants by default, namely, say, /bin/x64/Debug64 for both debugs and something similar for the release.

是什么原因促使我写这个问题,设计师会很困惑,找不到相应的库。

What prompted me to write this issue is that the designer gets confused and cannot find the appropriate library.

我想从Visual Studio解决方案配置,选择下拉我的期望目标(调试64位,64位版,调试的x86,x86的版本),并把它打造。

I would like to select from the Visual Studio solution configuration dropdown my desired target (Debug x64, Release x64, Debug x86, Release x86) and have it build.

我该怎么办呢?我究竟做错了什么?

How do I do that? What am I doing wrong?

创建只有两个解决方案配置,调试和发布,无法正常工作,因为没有解决方案平台下拉列表中,然后针对所有分项目。 Visual Studio中有,在我看来,太多的配置部分和平台部分。也许我只是失去了一些东西。

Creating just two solution configurations, Debug and Release, does not work, because there is no solution platform dropdown, which then targets all sub-projects. Visual Studio has, it seems to me, way too many configurations sections and platform sections. Maybe I am just missing something.

推荐答案

有关后人,这里就是答案。这听起来可能很明显,但它不是我的,所以......

For posterity, here is the answer. It may sound obvious, but it was not to me, so...

注:创建Debug64和Release64人的错误,花了我。我不仅要删除的解决方案Debug64和Release64 present(在配置管理器),但我不得不删除自动生成的Debug64和Release64每个项目(也是在配置管理器,只需在表中的部分)。那过了好一会儿。

Notes: Creating Debug64 and Release64 were mistakes that cost me. I not only had to remove the Debug64 and Release64 present in the solutions (in Configuration Manager), but I had to delete the automatically generated Debug64 and Release64 for each of the projects (also in Configuration Manager, just in the table part). That took a while.

  1. 请确保您有自动生成的调试和发布解决方案配置。

  1. Make sure that you have the automatically generated debug and release solution configurations.

在解决方案平台,x86和x64补充。默认值是任何CPU。

In the solution platforms add in x86 and x64. The default is Any CPU.

从解决方案配置和平台的下拉列表中选择(调试/发布和x86 / x64)的各种排列。确保项目的比赛,这是他们应该的。

Select from the solution configuration and platform dropdowns the various permutations of (Debug/Release and x86/x64). Make sure the projects match, which they should.

走进每个项目(选择项目名称,然后按Alt + Enter键)。

Go into each project (select project name and then Alt+Enter).

在项目属性页上,选择调试/发布的各种排列和x86 / x64的解决方案中的下拉列表中。确保目标处理器设置正确(这是应该的,但我发现因为我的previous尝试可能情况下,当他们没有,)。此外,设置输出目录。这应该是可以的,自动(如/ bin / 86 /调试等)。如果不是,修复。

In the project properties page, select the various permutations of Debug/Release and x86/x64 in the solution dropdowns. Make sure the target processor is set correctly (it should be, but I found instances when they were not, probably because of my previous attempts). Also, set the output directory. That should be okay and automatic (/bin/x86/Debug, etc.). If not, fix.

微软没有一个解决方案平台下拉列表中选择工具栏上的,所以如果你想改变的解决方案的平台,那么你就必须去构建|配置管理器,并选择适当的解决方案平台。您可以从Build选择解决方案配置,使用|配置管理器(Visual Studio将自动更新工具栏下拉列表中选择的解决方案配置),或简单地选择在Visual Studio下拉新的解决方案配置。

Microsoft does not have a solution platform dropdown in the toolbar, so if you want to change solution platforms, then you must go to the Build | Configuration Manager and select the appropriate solution platform. You can select the solution configuration either from the Build | Configuration Manager (Visual Studio will automatically update the selected solution configuration in the toolbar dropdown) or simply select the new solution configuration in the Visual Studio dropdown.

建设项目将完成剩余的工作。

Building the project will take care of the rest.

构建说明 1.在Visual Studio设计要求,以显示正确的用户控件的x86版本。这是不明显处的发病,但现在是。 Visual Studio的安装到C:\ Program Files文件(x86)的文件夹,而不是C:\ Program Files文件文件夹中,Visual Studio中的32位应用程序,而不是64位之一,因此它能够使用只有32位版本的设计。

Build Notes 1. The Visual Studio designer requires x86 versions of user controls in order to display properly. That was not obvious at the onset, but is now. Visual Studio installs to the "C:\Program Files (x86)" folder and not the "C:\Program Files" folder, making Visual Studio a 32-bit application, not a 64-bit one, hence its ability to "use" only 32-bit versions in the designer.

  1. 可能存在杂散/ bin中/调试和/斌/释放文件夹,但它们将不被使用。

  1. There might be stray /bin/Debug and /bin/release folders, but they will not be used.

我仍然试图让BuildVersionInc通过不同的配置构建相同的code时不增加,但是这是一个不同的问题。

I am still trying to get BuildVersionInc to not increment when building the same code through on different configurations, but that is a different issue.

这篇关于Visual Studio中:如何正确建立和指定的配置和平台,x64和x86的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆