Posted by: R Manimaran | July 21, 2010

Debugging the Custom STSADM command

In the previous article we have seen the steps to create a custom stsadm command. Suppose you want to debug the code as we do for other .net project, how to do.

Here are the steps.

Automate installing the assembly to GAC using visual studio.

We may change the code of the custom STSADM command many times and each time we need to place the assembly manually. We can automate the steps using Visual studio.

  • In Visual studio, Right click you project in the solution explorer and select properties.
  • Click the build events tab. In the post build text box place the following commands

“%programfiles%\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe” /uf $(TargetName)
“%programfiles%\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe” /if “$(TargetPath)”

  • Now each time you build the project it automatically uninstall the dll from GAC and install the updated dll.

Debugging

  • Click the Debug tab in the Project properties window.
  • Check the start external program checkbox and select the stsadm.exe from the path 12Hive\bin\STSADM.exe
  • Under Start option section specify the Command line arguments

  • Place the break points in the code and build the project.
  • Run the project. Now you can able to debug the code
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: