Visual Studio 2010:如何强制ASP.NET网站使用x86而不是“任何CPU”? [英] Visual Studio 2010: how to force ASP.NET website to use x86 instead of "Any 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.
这是因为ASP.NET在Visual Studio 2010中构建时,默认情况下为任何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而不是“任何CPU”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!