从非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"可以在这里找到字符串: msdn.microsoft/en-us/library/zekwfyz4(VS.80).aspx
where string can be found here: msdn.microsoft/en-us/library/zekwfyz4(VS.80).aspx
更多推荐
Visual Studio 2010:如何强制ASP.NET网站使用x86而不是&“任何CPU"?
发布评论