.NET SDK - Newbie runtime dependency error

3569
4
08-18-2011 03:51 AM
TomWilcox
New Contributor
Hi,

I am a complete newbie to ArcGIS SDK and I have encountered the following error when compiling and running a .NET Sample:


System.BadImageFormatException was unhandled
  Message="Could not load file or assembly 'ESRI.ArcGIS.System, Version=10.0.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86' or one of its dependencies. An attempt was made to load a program with an incorrect format."
  Source="RasterSyncExtensionReg"
  FileName="ESRI.ArcGIS.System, Version=10.0.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86"
  FusionLog="=== Pre-bind state information ===\r\nLOG: User = CSE\\tomw\r\nLOG: DisplayName = ESRI.ArcGIS.System, Version=10.0.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86\n (Fully-specified)\r\nLOG: Appbase = file:///C:/Program Files (x86)/ArcGIS/DeveloperKit10.0/Samples/ArcObjectsNet/RasterSyncWorkspaceExtension/CSharp/RasterSyncExtensionReg/bin/Debug/\r\nLOG: Initial PrivatePath = NULL\r\nCalling assembly : RasterSyncExtensionReg, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.\r\n===\r\nLOG: This bind starts in default load context.\r\nLOG: No application configuration file found.\r\nLOG: Using machine configuration file from C:\\Windows\\Microsoft.NET\\Framework64\\v2.0.50727\\config\\machine.config.\r\nLOG: Post-policy reference: ESRI.ArcGIS.System, Version=10.0.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86\r\nLOG: Attempting download of new URL file:///C:/Program Files (x86)/ArcGIS/DeveloperKit10.0/Samples/ArcObjectsNet/RasterSyncWorkspaceExtension/CSharp/RasterSyncExtensionReg/bin/Debug/ESRI.ArcGIS.System.DLL.\r\nERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.\r\n"
  StackTrace:
       at RasterSyncExtensionReg.RegisterExtension.Main(String[] args)
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:



-------------------------------

The paths to the referenced ArcObjects are correct...

Any help would be much appreciated.

Cheers,
Tom
0 Kudos
4 Replies
SumitSharma
New Contributor III
Hello Tom,

What kind of license do you have i.e. ArcInfo or ArcGIS engine ?

Also, Can you provide details on machine specification like is it 32 bit or 64 bit etc.


Cheers!!

Sumit
0 Kudos
TomWilcox
New Contributor
Hi Sumit,

Thanks for the response.

The license type (via ArcMap->About) is ArcInfo.

The machine is running 64-bit Windows Server 2008 R2.

Thanks,
Tom
0 Kudos
ToddHay
New Contributor
I'm curious if you ever resolved this error as I'm running into the same problem.  My environment is ArcInfo 10 sp2 on Windows 7 64-bit.  I'm using Visual Studio 2008 Express for C#, however I recently loaded the ArcOjbects .Net SDK 10 sp2. 

Thanks.

Todd
0 Kudos
ToddHay
New Contributor
I was able to answer my own question.  I had to change my target configuration to be x86 (32-bit) versus x64 (64-bit).  I did this as follows:


  • Tools -> Options -> Projects and Solutions -> General

  •     Check Show advanced build configurations

  • This then showed the Solution Platforms combobox


  • Select Configuration Manager... from this combobox


  • In the "Type or select the new platform," type "x86"


  • Hit OK


That should do the trick.
0 Kudos