win7系统使用engine进行开发报错,“未能加载文件或程序集”

0
分享 2014-05-12
使用vs2010加arcengine 开发winfrom应用,新建了uc,拖了几个控件后,编译,报未能加载文件或程序集“XX…/../../”或它的某一个依赖项。试图加载格式不正确的程序。
问题原因:这个是因为在64位机器上VS2010不能够编译32位程序在net3.5、3.0或者2.0框架下。
那么如何解决这个问题呢?
步骤:
1、关闭所有VS程序实例。
2、在VisualStudio Tools工具下,进入到命令提示选项。

3、更改目录进入<system_drive>:\ProgramFiles (x86)\Microsoft SDKs\Windows\v<x.xx>\bin\”.目录下,自己可以在这个目录下寻找,本人为C:\ProgramFiles (x86)\Microsoft SDKs\Windows\v7.0A\Bin

4、在命令中输入corflags/32bit+ ResGen.exe /force
5、执行完成之后就可以了,现在打开VS重新建立工程,会发现还是报错

6、接下来需要在所建立的工程中查找<project_name>.csproj文件,用记事本打开,并且在PropertyGroupsection 内容中加入<ResGenToolArchitecture>Managed32Bit</ResGenToolArchitecture> 保存之后可以发现程序可以照常编译了。问题解决!!!

总计,这样的方法虽然解决了这个问题,但是每次建立工程的时候都需要编辑<project_name>.csproj这个文件,没有什么好的办法,需要微软后期解决。
原文地址:
In order to work-around this issue you may need to perform. thefollowing steps:
1. Close all instances of Visual Studio.
2. From the Visual Studio Tools subfolder, open an elevated“Visual Studio Command Prompt (2010)” (using “Run as administrator” option).Change directory to "<system_drive>:\Program Files (x86)\MicrosoftSDKs\Windows\v<x.xx>\bin\”.
3. Issue the command :
corflags /32bit+ ResGen.exe /force
4. Open <project_name>.csproj in notepad.
5. Add the following property <ResGenToolArchitecture>Managed32Bit</ResGenToolArchitecture>under the PropertyGroup section. Save and close the csproj file.
http://support.microsoft.com/kb/2028833

文章来源:http://blog.csdn.net/sydbc/article/details/17961273

0 个评论

要回复文章请先登录注册