【转载】VS2010+ArcGIS Engine 10 在NetFramwork3.5下如何正确运行?

You are building an application targeted for x86 configuration on x64 machine with Visual Studio 2010. The project contains a resource file referencing a 32-bit assembly. Target Framework selected is 3.5, 3.0 or 2.0.

You may get the following error:

Form1.resx(161,5):error RG0000: Could not load file or assembly '<file_name>' or one of its dependencies. An attempt was made to load a program with an incorrect format. Line 161, position 5.

The diagnostic build-log shows that task “GenerateResource” fails.

Resgen.exe referenced: 

"<system_drive>:\Program Files (x86)\Microsoft SDKs\Windows\vx.x\bin\ResGen.exe"



SOLUTION:

In order to work-around this issue you may need to perform the following 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)\Microsoft SDKs\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.

posted @ 2012-03-02 23:17  xmwang  阅读(626)  评论(0编辑  收藏  举报