9 Replies Latest reply on Feb 17, 2014 3:36 PM by mhamel

    Remote Debugging PI ProcessBook Toolbar Add-In (Visual Studio 2008)

    helgesonc

      Hello,

       

      I'm having trouble trying to figure out how to remote debug a ProcessBook Toolbar Add-In.  I'm using Visual Studio 2008 and the following setup:

       

      * remote computer is on the same domain as dev computer
      * logged into remote computer with same credentials as dev computer
      * run msvsmon.exe on remote computer (Visual Studio 2008 remote debugger tool)
      * added the appropriate registry key to remote computer to recognize that I'm loading a custom add-in
      * have the "Debug" tab of my project setup for:
         * Start external program:  C:\Program Files\PIPC\Procbook\Procbook.exe
         * Working directory:  \\dev-computer\c$\path-to-x86\Debug     (this path is accessible to remote computer)
         * Use remote machine checked, value = remote computer name

       

      When I run my project in debug mode, msvsmon.exe (on remote computer) logs that I connected and ProcessBook starts on remote computer, but always with the error "'MyAddIn' could not be loaded.  Remove it from the list of available Add-Ins?"

       

      Is there a way to remote debug ProcessBook Add-ins?  If so, please explain.

       

      Thanks!
      Caleb

        • Re: Remote Debugging PI ProcessBook Toolbar Add-In (Visual Studio 2008)
          dhollebeek

          Did you use regasm (assuming it's .Net) to register your add-in on the remote PC?

            • Re: Remote Debugging PI ProcessBook Toolbar Add-In (Visual Studio 2008)
              helgesonc

              David,

               

              Thanks for the response.  I tried registering it (using pushd because of the UNC path), but I get the following error:

               

              =====

               

              Microsoft (R) .NET Framework Assembly Registration Utility 2.0.50727.3053

               

              Copyright (C) Microsoft Corporation 1998-2004.  All rights reserved.

               

              RegAsm : error RA0000 : Failed to load 'Z:\path-to\x86\Debug\MyAddIn.dll' because it is

               

              not a valid .NET assembly

               

              =====

               

              It is a valid assembly, though, because I can register/debug it locally just fine.

               

              Sincerely,

               

              Caleb

                • Re: Remote Debugging PI ProcessBook Toolbar Add-In (Visual Studio 2008)
                  dhollebeek

                  Does running regsvr on it help?

                   

                  :D

                    • Re: Remote Debugging PI ProcessBook Toolbar Add-In (Visual Studio 2008)
                      helgesonc

                      For anyone else who is interested, this is how I was able to remote debug a ProcessBook Add-In project.  If there is an easier way, please share!

                      Thanks,
                      Caleb

                       

                      How to Remote Debug a ProcessBook Add-In Project

                      1. On the dev computer, configure your project's Debug tab:
                        1. start external program: path to ProcessBook on the remote PC
                        2. working directory: UNC network path of your dev debug directory (ex:  \\dev-pc\c$\code\MyProject\MyAddIn\bin\x86\Debug)
                        3. check the box to use remote machine and fill in the remote PC name
                      2. Login to remote PC using your domain login; make sure you have admin rights on the remote pc
                      3. Install extensibilityMSM.msi on the remote PC if it's not already there (re-running the installer doesn't hurt anything; you won't get a message after it's installed)
                      4. On the remote PC, add your UNC debug folder to the trust list using CasPol.exe  (use the correct .NET version for your project)
                        example (use command prompt):

                        C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasPol.exe -m -ag 1 -url file://\\dev-pc\c$\Code\MyProject\MyAddIn\bin\x86\Debug\* FullTrust -exclusive on

                        type yes <enter> when prompted
                      5. Use RegAsm to register the DLL (and tlb) in your debug folder on the remote PC (use the correct .NET version for your project)
                        example (use command prompt):

                        C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe \\dev-pc\c$\Code\MyProject\MyAddIn\bin\x86\Debug\MyAddIn.dll /tlb \\dev-pc\c$\Code\MyProject\MyAddIn\bin\x86\Debug\MyAddIn.tlb
                      6. Copy and run the Microsoft remote debugger tool on the remote PC (msvsmon.exe; be sure to use the correct Visual Studio version)
                        If/when prompted, select "Unblock remote debugging from computers on the local network (subnet)" and click OK
                      7. Push your UNC debug directory drive on as the current directory (quick way to map a drive) via a command prompt.  it will probably use z: as the result, but make a note of which one it is
                        example (use command prompt):

                        pushd \\dev-pc\c$
                      8. Get the current GUID of the debug build by looking in the remote PC registry under:

                        HKEY_CLASSES_ROOT\MyAddin.Connect\CLSID
                      9. Run a predefined registry key for your project to make sure your add-in is registered (in the Windows registry) with ProcessBook via the correct entry under \PI - ProcessBook\Addins\MyAddin.Connect
                      10. Using the GUID from 8 and the drive from 7 above, create TWO new String values in the registry, both called CodeBase with the value being the pushd URL path to your debug DLL. ( 1.0.####.##### represents the arbitrary version number subkey value)

                        example:
                        HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{guid_from_8_above}\InprocServer32
                        CodeBase = file:///Z:/Code/MyProject/MyAddIn/bin/x86/Debug/MyAddIn.dll

                        HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{guid_from_8_above}\InprocServer32\1.0.####.#####
                        CodeBase = file:///Z:/Code/MyProject/MyAddIn/bin/x86/Debug/MyAddIn.dll
                      11. Press F5 in your add-in project to start debugging

                       

                       

                      ***EACH TIME YOU WANT TO COMPILE YOUR PROJECT AFTER A CODE CHANGE:***

                      1. UNregister the add-in dll on the remote PC (use the correct .NET version for your project)
                        example (use command prompt):

                        C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe \\dev-pc\c$\Code\MyProject\MyAddIn\bin\x86\Debug\MyAddIn.dll /unregister
                      2. Build your project on the dev PC
                      3. Repeat step 5 from above
                      4. Find out what the new GUID is (see 8 above)
                      5. Repeat steps 9, 10 & 11 from above with the new GUID

                      ***WHEN YOU ARE DONE TESTING***

                      1. UNregister the add-in dll on the remote PC
                      2. Use popd (command prompt) or disconnect to remove the mapped drive

                       

                       

                      Note on registry key locations: if your remote PC is x64, you will need to use Wow6432Node where applicable.