The map projection folder in 10.1 is different from 10.0. "Unable to locate the USA Contiguous Albers Equal Area Conic USGS.prj file." ISpatialReferenceFactory3.CreateSpatialReference method was used to get the projection parameters. This approach doesn't need a direct access to the .prj file.
The other code works normally when BAGIS V2 compiled in 10.0 SDK was installed on 10.1.
The Excel functions also work normally on computers with Office 2010 (Ver 14) installed.
GXCatalogClass does not work with .NET framework 3.5
Cannot use an ArcCatalog dialog to select a file. Error message: 'Unable to cast object of type 'System.__ComObject' to type 'ESRI.ArcGIS.Catalog.GxCatalogClass'.
Solution is to switch project to use .NET framework 4. When BAGIS-P is compiled under ArcGIS 10.0 with .NET Framework 4, the Add-In runs in both 10.0 and 10.1. See .NET Framework 4.0 - Compilation for details on how to switch a project to compile under .NET Framework 4.
Update ESRI references that have missing path ("<The system cannot find the reference specified>"). Set the value of the Specific Version property of the reference to "False."
Make sure to update the references for both the BAGIS project and the BAGIS_ClassLibrary project.
Change the version value in the " <Target name="Desktop" version="10.0" />" statement in Config.esriaddinx to match the ArcGIS SDK version.
BAGIS (V2) has a few MicroSoft Excel references for Office 12. On computers with different versions of Office, please remove the other versions of references that point to "Microsoft.Office.Interop.Excel.dll."
When UPGRADING or REINSTALLING your ArcMap client you may need to change the supportedRuntime version in the ArcMap.exe config and ArcCatalog.exe config files to v4.0.30319. See this documentation from ESRI for more information.
.NET Add-In Build Instructions on ArcGIS 10.0 SDK for both ArcGIS 10.0 and 10.1
Right click on the project name in the VB Solution Explorer and select Properties
Click the Compile menu option
Click on the Advanced Compile Options... button near the bottom
Change the Target Framework (all configurations) to .NET Framework 4 and save your changes. Click through any warnings from Visual Studio. It might take a few moments for the project to restart.
If you are working with an older project, you may see some error messages similar to this:
Interop type XXX cannot be embedded. Use the applicable interface instead.
To fix these errors, remove the "Class" suffix from the object declaration. For example: GxCatalogClass becomes GxCatalog. For more details on this error message, consult this MSDN article.
You will also need to update the AddIn Language in the ESRI Config.esriaddinx configuration file.
This line:
<AddIn language="CLR" library="BAGIS_P.dll" namespace="BAGIS_P">
Becomes:
<AddIn language="CLR4.0" library="BAGIS_P.dll" namespace="BAGIS_P">
After making these changes, you should be able to compile and deploy the Add-In.
VS 2010 allows users to determine if they want to embed object types from managed assemblies by setting the "Embed Interop" property of a reference. By setting the property to "TRUE" of some assemblies, the esriaddin can work with different versions of ArcObjects assemblies that come with ArcGIS 10.0 and 10.1. For more information, see "Embedding Type from Managed Assemblies".
The two assemblies in question were Geodatabase and DataSourcesGDB. Both assemblies should be set to "TRUE" in both BAGIS(-H/-P) and BAGIS_ClassLibrary. Doing so resolves the runtime errors associated with FileGDBWorkspaceFactoryClass.
Breakpoints and debugging features in the VB Solution stop working when debugging .NET Framework 4 code on ArcGIS 10.0 (including ArcMap, ArcCatalog, etc). The default ArcMap 10.0 supports only .NET Framework 3.5 (or earlier version) assemblies. This problem can be resolved by the following procedures:
Find the ArcMap.exe.config (or ArcCatalog.exe.config) file in the C:\Program Files (x86)\ArcGIS\Desktop10.0\Bin folder.
Change the version of the supportedRuntime parameter to V4.0.30319. See the edit example below.
<!--supportedRuntime version="v2.0.50727"/-->
<supportedRuntime version="v4.0.30319"/>
After changing the supportedRuntime parameter, you may receive a series of warnings about "disconnected context". These warning cause the debugger to stop as if it is at a breakpoint. You need to step over to continue debugging. This is not a problem with PSU code but rather an issue with the ESRI source code.
You can turn the warnings off in the Visual Studio debugger settings
From the Debug menu, select Exceptions...
Expand the Managed Debugging Assistants section
Uncheck the thrown checkbox for ContextSwitchDeadlock and DisconnectedContext MDA's
For more information see this discussion thread