Visual Studio 2010:如何强制ASP.NET网站使用x86而不是&“任何CPU"? [英] Visual Studio 2010: how to force ASP.NET website to use x86 instead of "Any CPU"?

查看:76
本文介绍了Visual Studio 2010:如何强制ASP.NET网站使用x86而不是&“任何CPU"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从非ASP.NET应用程序使用SharePoint DLL(仅x86)时,可以将平台目标"设置为x86(而不是任何CPU"),这样Visual Studio 2010和该应用程序都会加载SharePoint程序集很好.

When using SharePoint DLLs (which are x86 only) from a non-ASP.NET app, you can set the "Platform target" to x86 (instead of "Any CPU") so both Visual Studio 2010 and the app load the SharePoint assemblies fine.

但是,在x64开发系统上开发ASP.NET应用程序时,在构建网站时会收到以下可怕的错误消息:

However, when developing ASP.NET applications on an x64 development system, you get this dreaded error message when building the web-site:

无法加载文件或程序集"Microsoft.SharePoint.Search"或一个它的依赖关系.尝试是使程序加载格式不正确.

Could not load file or assembly 'Microsoft.SharePoint.Search' or one of its dependencies. An attempt was made to load a program with an incorrect format.

这是因为在Visual Studio 2010中进行构建时,默认情况下ASP.NET是任何CPU".

This is because ASP.NET by default is "Any CPU" when building in Visual Studio 2010.

我该如何更改?

我尝试了网站的属性页web.config,但无济于事.

I tried the property pages for the web-site, the web.config, but to no avail.

注意:这是针对开发系统的.我知道对于服务器系统,我可以通过在应用程序池默认值"中将启用32位应用程序"设置为真"来更改应用程序池以强制加载32位x86.

Note: this is for the development system. I know that for the server system, I can change the application pool to force loading of 32-bit x86 by setting "Enable 32-Bit Applications" to "True" in the "Application Pool Defaults".

推荐答案

您可以在< compilers>

compilerOptions="/platform:string"

可以在这里找到字符串: http://msdn.microsoft.com/en-us/library/zekwfyz4(VS.80).aspx

where string can be found here: http://msdn.microsoft.com/en-us/library/zekwfyz4(VS.80).aspx

这篇关于Visual Studio 2010:如何强制ASP.NET网站使用x86而不是&amp;“任何CPU"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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