Select to view content in your preferred language

Windows 7 & IToolBar/ICommand Deployment Issues?

1812
22
07-19-2011 01:14 PM
JamesCrandall
MVP Alum
Has anyone run into deployment issues with a custom IToolBar/Command Class and a regular old Setup Project that builds an .msi on a Windows7 Pro (32bit I think) machine????

I have a user that for some reason cannot load the extension/toolbar (it's not really an extension exactly).  But after running the .msi (no error), then choosing "Add From File" to load the .tlb, it still does not show up in the Commands list (so as to place a check to turn the toolbar on).

This same .msi runs and the toolbar shows up just fine on all other installs.

Thanks for any input.
0 Kudos
22 Replies
JamesCrandall
MVP Alum
I see that I incorrectly told you that your original installer class code was for registering an addin.  That's not true, that is the code you need for your installer to kick off the component category registration for ArcGIS 10.  The code I posted in that reply is for ArcGIS 9.3.1 and earlier.  So, if you're deploying for 10 your original installer class code should work now that you corrected the registration code in your toolbar class.  If you're deploying for 9.3.1 or earlier then I'm not sure what the problem might be.  I think someone mentioned that the installer needs elevated permissions in order to run correctly.  You can do this by right-clicking the setup.exe and choosing Run as Admin.  I'm not at my work computer right now so I can't look at our installers to see what else we may be doing.



Thanks a bunch for following along and contributing to this issue, Neil -- I appreciate the efforts. 

I can most certainly revert back to adding that Installer class back into the original assembly (where the ICommand/Toolbar classes are located), no problem!  However, since that time I have used the walkthru as a guide and ditched that Installer and went with the recommended InvokeESRIRegAsm.dll/assembly approach (where they suggest to create a whole new project that contains the Installer class and you add this as a reference in the Setup project).

I assume that I should remove this "new" Installer class/assembly and revert back to the original approach and continue with the updates I have made?  Yes, this is all for ArcGIS10, I've finally had all clients moved on from 9.x!
0 Kudos
JamesCrandall
MVP Alum
Well....  I was finally able to manually register the components, and I still need to implement Neil's suggested solution by way of the Setup/Installer, but the following is how I was able to get this resolved:

First of all, the .msi always ran without error, directories correctly created, .dll's all copied over, etc... The only issue with the Setup package is that it simply doesn't register the components.  (still working on this, but very close). 

So...  I HAVE HAD to get this thing going on the client's W7 workstation and even though no errors would popup after selecing to Customize-->Add From File (it always said "Objects Loaded"), but the toolbar would NOT show up in the list of Commands!  So, here's what you do:

Right-Click the shortcut to start ArcMap10 and choose "Run as Administrator".  Then go thru the "Add From File" process and the Toolbar will show up in the list of Commands.

Yep.

Here's some credit to the problem solver (2nd from last post): http://forums.arcgis.com/threads/5602-Add-from-file-customize-tools-in-Win-7-fails?highlight=manuall...

Neil -- can't thank you enough and I'll report back after I implement your suggestions on getting the actual setup.exe to do this registering stuff for me rather than having to hack thru these things manually.

James
0 Kudos
JamesCrandall
MVP Alum
I know the OP is about W7, but I think my initial problems stemmed from a flawed ICommand/IToolBarDef.  Well, they DO work, I just wasn't able to register them with ESRIRegAsm and a Setup package.

This is silly, but completely on me as to why I could manually "Add From File" the .tlb and the Toolbar would appear.  Basically I was missing 2 seperate COM Registration functions, which I *thought* were the same thing, but apparently are not and both are required in the #Region of the IToolBarDef in order for ESRIRegAsm to register it and have it automatically appear after the setup is run.

So, just here it is.  I already had the "ArcGISCategoryRegistration/Unregistration sub's, but was missing the RegisterFunction/UnRegisterFunction sub's.  These were added just below the COM GUID's #Region:

#Region "COM Registration Function(s)"
    <ComRegisterFunction(), ComVisibleAttribute(False)> _
    Public Shared Sub RegisterFunction(ByVal registerType As Type)
        ' Required for ArcGIS Component Category Registrar support
        ArcGISCategoryRegistration(registerType)

        'Add any COM registration code after the ArcGISCategoryRegistration() call

    End Sub

    <ComUnregisterFunction(), ComVisibleAttribute(False)> _
    Public Shared Sub UnregisterFunction(ByVal registerType As Type)
        ' Required for ArcGIS Component Category Registrar support
        ArcGISCategoryUnregistration(registerType)

        'Add any COM unregistration code after the ArcGISCategoryUnregistration() call

    End Sub
#Region "ArcGIS Component Category Registrar generated code"
    ''' <summary>
    ''' Required method for ArcGIS Component Category registration -
    ''' Do not modify the contents of this method with the code editor.
    ''' </summary>
    Private Shared Sub ArcGISCategoryRegistration(ByVal registerType As Type)
        Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID)
        MxCommandBars.Register(regKey)

    End Sub
    ''' <summary>
    ''' Required method for ArcGIS Component Category unregistration -
    ''' Do not modify the contents of this method with the code editor.
    ''' </summary>
    Private Shared Sub ArcGISCategoryUnregistration(ByVal registerType As Type)
        Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID)
        MxCommandBars.Unregister(regKey)

    End Sub

#End Region
#End Region
0 Kudos