原文 http://www.gisall.com/html/47/122747-4141.html
问题描述:
前段时间装了个VS2010,用ArcEngine10在VS2010中基于.Net Framework 3.5新建一个MapControl Application工程,创建过程如下:
1. Start Visual Studios 2010.
2. Select New Project….
3. Expand ArcGIS->Extending ArcObjects and select MapControl Application for Visual C# using the .NET Framework 3.5 and enter Project Name and OK.
4. This starts a new project list items (Properties, References, .cs code, etc) automatically added to the Solution Explorer.
5. At this point, I can Build the project either under DEBUG or RELEASE modes and using the x86 Solution Platform. and run the Project w/ or w/o Debugging and I get the basic, empty MapControl Application. Data can be loaded or .MXD files loaded w/o a problem
但是程序一运行便出类似以下的错误:
Error 1 未能加载文件或程序集“file:///C:/Program Files (x86)/ArcGIS/DeveloperKit10.0/DotNet/ESRI.ArcGIS.3DAnalyst.dll”或它的某一个依赖项。试图加载格式不正确的程序。 行 161,位置 5。 Form1.resx 161 5 WindowsFormsApplication2
通过手动加载这些类库文件也是出现一样的问题。
编译环境:
操作系统:Windows 7 64bit旗舰版
编译环境:VS 2010旗舰版 + ArcEngine 10
解决方法:
方法一:这个问题是因为VS2010在构建.Net Framework 3.5, 3.0 or 2.0 on x64 machine的32位程序造成这样的问题,详细解决方法参见:http://support.microsoft.com/kb/2028833
方法二:将应用程序修改到.Net Framework 4.0环境下,如下图: