如何在Visual Studio 2010中将x64(或任何CPU)添加为生成选项(从控制台应用程序到类库) [英] How to add x64 (or Any CPU) as a build option in Visual Studio 2010 (from console application to class library)

查看:210
本文介绍了如何在Visual Studio 2010中将x64(或任何CPU)添加为生成选项(从控制台应用程序到类库)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最初,我使用大众运输作为服务总线创建了控制台应用程序.最近,我切换到 NServiceBus ,它不需要您创建控制台应用程序,而是需要一个类库.在项目属性中,我仅将设置更改为将其从控制台应用程序更改为库,但是您只能为x86构建它的约束仍然有效.

Initially, I created a console application using Mass Transit as my service bus. Recently, I switched to NServiceBus, which doesn't require you to make a console application, but a class library instead. In the project properties, I simply switched the setting that changes it from a console application to a library, but the constraint that you can only build it for x86 is still in effect.

由于它是一个控制台应用程序,所以我现在不能将构建类型更改为"Any CPU",它现在应该是有效的.有什么方法可以完全将我的应用程序更改为类库,以便我可以运行build Any CPU选项?我需要创建一个新项目,将文件复制到该项目中然后继续吗?还是像更改项目(.proj)文件中的内容一样简单?

I can't change the build type to Any CPU now that it is a console application, which should now be valid. Is there any way to completely change my application to a class library so that I can run the build Any CPU option? Do I need to create a new project, copy files into it and continue that way? Or is it as simple as changing something in the project (.proj) file?

堆栈溢出问题 缺少调试|项目的任何CPU构建配置,并且在Windows x64上默认为Debug | x86 仅针对控制台应用程序提供了有关x86问题的更多信息.

The Stack Overflow question Missing Debug|Any CPU build configuration for projects and defaulting to Debug|x86 on Windows x64 gives more context around this issue of x86 only for console applications.

推荐答案

您只需要在配置管理器中为Any CPU添加配置.

You just need to add a configuration for Any CPU in the configuration manager.

1)右键单击解决方案,然后选择属性"

1) Right-click the solution and select Properties

2)选择配置属性",然后单击配置管理器...".

2) Select Configuration Properties, then click Configuration Manager...

3)将活动解决方案平台更改为任何CPU.如果没有任何CPU平台,请跳至#4.

3) Change the Active Solution platform to Any CPU. If there is no Any CPU platform, skip to #4.

4)单击类库的平台"列下组合框中的箭头,然后选择新建...".

4) Click the arrow in the combo box under the Platform column for your class library, and select New...

5)确保在新平台"下选择任何CPU".如果在步骤3中没有任何CPU解决方案平台,则确保选中创建新的解决方案平台"复选框.然后单击确定.

5) Make sure "Any CPU" is selected under New Platform. If there was no Any CPU solution platform in step 3, then make sure the "Create new solutions platform" checkbox is checked. Then click OK.

6)选中您的类库的构建"列中的复选框

6) Check the checkbox in the "Build" column for your class library

7)关闭配置管理器,然后打开类库的属性

7) Close out of the Configuration Manager, and open the properties for your class library

8)选择用于平台的任何CPU",然后选择用于平台的任何CPU"目标并保存.

8) Select Any CPU for Platform, then select Any CPU for Platform target, and save.

(步骤8是否必要,取决于先前的配置.)

(Step 8 may or may not be necessary, depending on what has been done with the configurations previously.)

这篇关于如何在Visual Studio 2010中将x64(或任何CPU)添加为生成选项(从控制台应用程序到类库)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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