VS 2010 ArcObject 10 MapControl App Compile Problem

3146
12
10-27-2010 02:32 PM
MarkParr
New Contributor
I am experiencing a problem on my Windows 7 Ultimate 64 bit laptop using Visual Studios 2010 to develop an ArcObjects 10 MapControl Application.  Any idea as to the problem would be greatly appreciated.  Here are the steps one at a time leading up to the problem:

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

Here is where the problem starts:

6.  Now, double click on the MAINFORM.CS pulling up the Main Form which contains an ArcGIS 10 Engine ToolbarControl, TOCControl, MapControl, and LicenseControl.
7.  At this point, try to BUILD the application and the following error takes place during the build: 

Error 1 :
Could not load file or assembly 'file:///C:/Program Files (x86)/ArcGIS/DeveloperKit10.0/DotNet/ESRI.ArcGIS.ADF.Local.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.   Line 189, position 5.

Double clicking on the error pulls up the following code in MainForm.resx:

</value>
  </data>
  <data name="axToolbarControl1.OcxState" mimetype="application/x-microsoft.net.object.binary.base64">
    <value>
        AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
        LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFTeXN0
        ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAKgMAAAIB
        AAAAAQAAAAAAAAAAAAAAABUDAAAPAAAAAgAAAAEAAAAKAAAAAAAAAACsXgAAUQIAAAAAAAAcAAAAYQB4
(lot more lines deleted)

And places the cursor after the SLASH in the </data> XML parameter.

Any idea what is going on here?
0 Kudos
12 Replies
MarkParr
New Contributor
I did one thing did today where I ran Visual Studio as Administrator but that did not make a difference on the compile of the program.  I continued to get the same error.

Also, once this error is received, the project will not compile from that point forward.
0 Kudos
MarkParr
New Contributor
More info:

I tried a GlobeControl application.  Same type of thing in that I was able to compile the program and run the application.  However, once I opened the MainForm.cs and then tried to compile it failed.  This time it died w/ the following error:

Error 1

Could not load file or assembly 'file:///C:/Program Files (x86)/ArcGIS/DeveloperKit10.0/DotNet/ESRI.ArcGIS.3DAnalyst.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format. Line 129, position 5.

c:\users\mark\documents\visual studio 2010\Projects\GlobeControlApplication1\GlobeControlApplication1\MainForm.resx
0 Kudos
ChristianDegrassi
New Contributor
Hi,

have you solved the problem, I have the same issue.
Fresh ArcEngine installation on VS2010, with Windows 7 Pro x64

Cheers
0 Kudos
MarkParr
New Contributor
Contacted ESRI Support and their notes indicated that it was actually a problem w/ MicroSoft and Visual Studios.  Support person directed me to this following MicroSoft KB Article:

http://support.microsoft.com/kb/2028833
0 Kudos
StevenVaccaro
New Contributor
Thanks for the info, this worked prefectly!
0 Kudos
RonVincent
Occasional Contributor
I've come across this issue also. To remove this error, double-click on the error in the Error List and it will direct you to the *.resx file. Then, I just simply remove the offending lines:

  <data name="axSymbologyControl.OcxState" mimetype="application/x-microsoft.net.object.binary.base64">
    <value>
        AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
        LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFTeXN0
        ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAswAAAAIB
        AAAAAQAAAAAAAAAAAAAAAJ4AAAADAAAAAgAAAAAAAAAAAAAAAGsfAABjGwAAAQAAAP///wAAAAAAAAAA
        AAAADQAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAs=
</value>
  </data>

Notice that is has base64 at the end of the data name element. You can also just change it from base64 to base32 and that fixes the error. I've only seen this happen with Esri controls.

Ron
0 Kudos
KevinGooss
Occasional Contributor
Using the suggested microsoft fix did not work for me and now i can no longer build anything with studio. is there a way to reverse this? why is this still and issue over a year later?
0 Kudos
KevinGooss
Occasional Contributor
on a different machine i tried to just edit the base64 entries and make them base32.
this got it to compile but when it ran it is not the same. all of the items in my map app are juxtaposed now.
0 Kudos
VinhLam
New Contributor
I encountered the same error while compiling (Could not load file or assembly 'file:///C:/Program Files (x86)/ArcGIS/DeveloperKit10.0/DotNet/ESRI.ArcGIS.ADF.Local.dll'.....)

Double clicking the error led me to the .resx file of one of my WinForms.

<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAICAAAAAAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAACAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAdXh4V0pLS/9dX17xb29v73d6eu+AgYHvent773Bw
...
</value>
</data>

To fix my particular problem, I changed the version number of the System.Drawing assembly to be 2.0.0.0.

A handful of my WinForms had similar problems and I was able to run my application after changing them all.

The solution suggested at http://support.microsoft.com/kb/2028833 worked for me as well, but it is a global change that affects all Visual Studio projects. So when I compiled another project, I got a bunch of errors.

Changing the base64 to base32 seemed to have no affect on my error.
0 Kudos