4

I was given an ArcGIS 9.3.1 extension built in Visual Studio (VS) that needs to be updated to work in ArcGIS 10. When I open the VS project on my computer (that has ArcGIS 10 installed on it) I get a few library reference errors. I attempted to remove the references then add them back in thinking that would resolve the error, however the errors are still present. Why are these references not being viewed by VS? Here are the errors:

Update

I changed the Target .NET Framework from 2.0 to 3.5 and added in the missing file and assemblies via the MSSetup>Primary output from HT.MSExtension(Active). This removed all the errors except error 4. Do I need to re-source ESRI.ArcGIS.ADF.dll to ESRI.ArcGIS.ADF.Local.dll?

Update2

I updated ADF to ADF.Local, however I'm still getting error 4. Any ideas?

Error 2 Unable to find source file 'C:\1_Projects\MS\Source\MS_ArcGIS-Extension\MSSetup\stdole.dll' for assembly 'stdole.dll', located in '[TARGETDIR]' C:\1_Projects\MS\Source\MS_ArcGIS-Extension\MSSetup\MSSetup.vdproj MSSetup

Error 1 Unable to find source file 'C:\1_Projects\MS\Source\MS_ArcGIS-Extension\MSSetup\ESRI.ArcGIS.Editor.dll' for assembly 'ESRI.ArcGIS.Editor.dll', located in '[TARGETDIR]' C:\1_Projects\MS\Source\MS_ArcGIS-Extension\MSSetup\MSSetup.vdproj MSSetup

Error 4 Could not load file or assembly 'file:///C:/Program Files (x86)/ArcGIS/DeveloperKit10.0/DotNet/ESRI.ArcGIS.ADF.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format. Line 195, position 5. C:\1_Projects\MS\Source\MS_ArcGIS-Extension\HT.MSExtension\Forms\msManager.resx 195 5 HT.MSExtension

Error 3 Unable to find source file 'C:\1_Projects\MS\Source\MS_ArcGIS-Extension\MS.mxd' for file MS.mxd', located in '[TARGETDIR]', the file may be absent or locked. C:\1_Projects\MS\Source\MS_ArcGIS-Extension\MSSetup\MSSetup.vdproj MSSetup

Thank you

12
  • 1
    Do those files (specifically, the DLLs) exist in the locations specified in the errors?
    – Radar
    Oct 4, 2011 at 16:25
  • 1
    What version of VS was the initial extension created in? Oct 4, 2011 at 16:33
  • @Radar, Yes they do.
    – artwork21
    Oct 4, 2011 at 16:45
  • @Jakub, Orig was 08, I'm using 10 now.
    – artwork21
    Oct 4, 2011 at 16:46
  • 2
    Also, you might try this from microsoft kb article 2028833 Oct 4, 2011 at 20:05

3 Answers 3

6

It appears you have a setup project that is part of your solution. You might try having it run EsriRegasm, as described in Chris Garrard's blog post.

When you build your project you'll also need to call EsriRegasm, as described here.

<Target Name="BeforeClean">
  <Exec
    WorkingDirectory="$(CommonProgramFiles)\ArcGIS\bin"
    Command="esriRegasm.exe &quot;$(TargetPath)&quot; /p:Desktop /u /s"
    Condition="Exists('$(TargetPath)')"/>
</Target>
<Target Name="AfterBuild">
  <Exec
    WorkingDirectory="$(CommonProgramFiles)\ArcGIS\bin"
    Command="esriRegasm.exe &quot;$(TargetPath)&quot; /p:Desktop /s"/>
</Target>

Update

Error 4 Could not load file or assembly 'file:///C:/Program Files (x86)/ArcGIS/DeveloperKit10.0/DotNet/ESRI.ArcGIS.ADF.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format. Line 195, position 5. C:\1_Projects\MS\Source\MS_ArcGIS-Extension\HT.MSExtension\Forms\msManager.resx 195 5 HT.MSExtension

For this error see this Esri Kb article which directs to a Microsoft KB article: MSBuild 4.0 or Visual Studio 2010 may fail to compile a 32-bit application targeted for .Net Framework 3.5, 3.0 or 2.0 on x64 machine.

Esri support walked me through a process where I edited the resx file with a text editor, replacing Base64 with Base32 (or maybe other way around). Later I found out about this fix, which seems more appropriate.

1
  • Nice! I wish the Google Sketchup team knew about this. I would love to have the Google Sketchup 6 Extension for ArcGIS 9 back. Oct 4, 2011 at 18:05
6

Take a look at the following:

Esri Migration doc

Specifically

  • Reference ESRI.ArcGIS.ADF.Local assembly
  • Set ESRI assemblies Specific Version property
  • Platform CPU target changes
5

In addition to @jmhauck answer; because the application framework has changed in version 10 you might also consider just to build a new extension using the ArcGIS 10 SDK using one of the "Extending ArcObjects" templates and copy your functions and procedures from your legacy extension.

enter image description here

More info on extending ArcObjects here

1
  • Similar to what Mr. Kuykendall posted below the ESRIRegAsm topic in this document outlines how you could unload and edit the project to include the calling of ESRIRegAsm to register or un-register your component when building or cleaning your VS solution. This is a key step that would be automatically handled for you if you create a new project using the ArcGIS 10.0 VS templates.
    – jmhauck
    Oct 4, 2011 at 21:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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