Debugging a custom command

Everyone who writes a custom Vault Explorer command ends up with the same development environment, more or less.  So I thought I would quickly go over the setup that I use, just to have it documented somewhere.

Goal
A typical development process for writing a program is 1) write code 2) build 3) debug 4) repeat.  The goal of the development environment is to make those steps as painless as possible.

The development computer
There are a bunch of things you will want to have on your computer.  Item 1 is the only hard requirement, but items 2 and 3 will make your life much easier.

  1. Visual Studio
  2. The Vault client.  Base Vault doesn't have the ability to run custom commands.  So use either Workgroup, Collaboration, or Professional depending on your requirements.
  3. The Vault SDK.  If you don't have the Vault Server installed on your computer, copy the SDK over from the server machine.

Note: I'm using Visual Studio 2008 Team Edition.  I do not know if the Express Editions have all the capabilities that I am about to go over.

Visual Studio project references
OK, your computer is set up.  Now you can create your Class Library project.  You will need to reference Autodesk.Connectivity.Explorer.Extensibility.dll from your Vault client's "Explorer" folder.  This DLL is already part of the client.  So tell Visual Studio not to copy the DLL to the output folder.

If you are making server calls, you will probably want to reference Autodesk.Connectivity.WebServices.dll from the SDK.  This DLL is not part of the client, so you want to keep the default setting of having the DLL copied to your output folder.

Creating the .vcet.config file
Add a new XML file to your project and change the name to [project name].vcet.config.  You can look at the SDK documentation for more information on the XML syntax.  However there are some things I want to add.

If you are deploying anything more than 1 DLL, you need to set AddFolderToAssemblyProbingPath to true.  In fact, you can set this to true always.  I don't see a reason for ever setting this to false.

In the Visual Studio properties on the .vcet.config file, set the Copy to Output Directory setting to "copy if newer".  This way, when you build, the config file goes with you.

Debug settings
For debug mode, you can just set the build target to be the Extensions folder for your Vault Explorer client.  (ex. C:\Program Files (x86)\Autodesk\Vault Professional 2011\Explorer\Extensions\HelloWorld\ ).

Next go to the Debug settings and set the Start Action to "Start External Program".  Supply the path to your Vault Explorer EXE (ex. C:\Program Files (x86)\Autodesk\Vault Professional 2011\Explorer\Connectivity.VaultPro.exe ).  And set the working folder to the EXE directory.

Debugging
You should be all set now.  When you run in debug mode, it should start up Vault Explorer and halt at any breakpoints you set in your code.


Comments

8 responses to “Debugging a custom command”

  1. Hi Doug,
    I’m trying to debug a Vault Client Addin (test) but can’t get it to work. I actually can’t get it to register at all. I’ve downloaded your ‘EffectiveFolderPermissions’ and made all settings as you suggested above, but the addin doesn’t load (no new menu options available). So what am I missing here?
    TIA!
    Joeri

  2. This is a common problem. It’s quite easy to miss something and the result is your command not showing up (no error).
    Here is a list of things to check:
    – You are using the 2011 release or above
    – You are using Vault Workgroup, Collaboration or Professional. In other words, not the base version of Vault.
    – You did a reset of the menus after you first deployed your DLL.
    – You deployed your DLL to the correct location. Make sure not to spell “Extensions” wrong.
    – You deployed your .vcet.config file to the same location as the DLL.
    – You have correct information in the .vcet.config file.
    – You provided a display name for all your CommandSite objects.
    This list is probably not complete, but these are the ones I have run into.

  3. Justin S Avatar
    Justin S

    Where do you reset your menus after deploying the DLL? I’m trying to make some changes to your Effective Folder Permissions add-in so that I can manage group permissions as well as user permissions. I’ve made a few changes to to the Util.cs, WebServiceSubclass.cs, and MainForm.cs files but left everything else the same. The vcet.config file is exactly the same. I’ve followed the instructions above and when I press the play button in visual studio vault opens up as expected and the dll and config files are in the Extensions\EffectiveFolderPermissions. I am using Vault Professional. Is there anywhere I can check for an error message?

  4. Justin S Avatar
    Justin S

    I set a break point inside the OnLogOn method in the command class and the break point got hit so it seems like the code is at least getting loaded. It looks like I’m getting the Effective Folder Permissions available as a context menu item and not in the tools menu as i had expected. I’ll investigate further.

  5. You can do a menu reset by right-clicking on the menu bar in Vault. Select the Customize option and a dialog will pop up that will allow you to reset the menu and toolbars. After the reset, your custom command should show up properly.

  6. I’m not compile EffectiveFolderPermissions in vs 2010 whith .NET 4.0 ‘EffectiveFolderPermissions.Command’ does not implement interface member ‘Autodesk.Connectivity.Explorer.Extensibility.IExtension.CustomEntityHandlers() Please say what am I missing in project?

  7. A new function got added to the interface in Vault 2013. In Visual Studio, run the “Implement Interface” command and it should add the new function to your code.
    All you need to do with CustomEntityHandlers() is return null.

  8. how to debug service extentions from autocad vault clint rather than explorer client.

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading