I recently migrated my desktop from ArcGIS 10.1 to 10.3.1 and visual studio from 2010 to 2013. I am now getting a problem trying to run an Engine application. It builds fine but when I try to debug it I get the above error. The error occurs right at the start when trying to get a list of installed environments "For Each item As ESRI.ArcGIS.RuntimeInfo In irs":

   Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup

        Dim irs As Generic.IEnumerable(Of ESRI.ArcGIS.RuntimeInfo)

        irs = ESRI.ArcGIS.RuntimeManager.InstalledRuntimes
        For Each item As ESRI.ArcGIS.RuntimeInfo In irs
        Dim bInit As Boolean
        bInit = ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop)

    End Sub

From what I've read the problem is not that the ArcGISVersion.dll cannot be found (it imports into the solution no problem) it is that this .dll seems to call another .dll that cannot be found. The stack trace from the error is:

       at ESRI.ArcGIS.NativeInterop.DllGetClassObject(Guid& rclsid, Guid& riid, Object& ppv)

   at ESRI.ArcGIS.RuntimeManager.GetArcGISVersion()

   at ESRI.ArcGIS.RuntimeManager.<get_InstalledRuntimes>d__0.MoveNext()

   at SanGIS_RoadMaintenance.My.MyApplication.MyApplication_Startup(Objectsender, StartupEventArgs e) 
in R:\Work\Sangis\SanGISEditTools\SanGIS_RoadMaintenance\SanGIS_RoadMaintenance\Utilities\ApplicationEvents.vb:line 24

I'm not familiar with ESRI.ArcGIS.NativeInterop and I don't know how to add a reference to it.

Also I created a new ArcEngine project from scratch and that runs fine, no errors when debugging or binding to the license manager.

Does anybody know why this app might be failing after migration?

  • 1
    From memory you need to go to all of your references, find the properties tab and set 'specific version' and 'copy local' to false. Then clean and build the project. If that doesn't work remove the ArcGis (engine) references and add new ones (be sure to set specific version and copy local). – Michael Stimson Jul 30 '15 at 23:48
  • @MichaelMiles-Stimson thanks for your suggestion, I went through all the referenced assembly's but the settings were correct, I did eventually figure it out. – Dowlers Jul 31 '15 at 18:34

The problem was somehow the target CPU of the project had changed. If you go to project properties and then compile there are 2 places where the target platform is set. On the first line there is a dropdown for "Platform". This was correctly set to x86. But 4 rows down there is another drop down for "Target CPU". This was set to x64 somehow. Once I changed it to x86 it compiled fine. I don't know how this changed unless it was done automatically as part of the visual studio upgrade of the solution file from VS 2010 to VS 2013.

Anyway problem solved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.