This is a tutorial for setting up your ServUO project in Visual Studio for debugging. This is not a tutorial on how to debug with Visual Studio as there are plenty of resources on the web for this. I will show a couple basics however for this tutorial. I'm using Visual Studio 2010 but the process should be the same for other version.

First open your ServUO project up in Visual Studio by double clicking your 'ServUO.sln' file. Once the project is loaded click Build Menu and select Build Solution to ensure you have the binaries needed for the following steps.as28.postimg.org_slsgyvdvx_image.png

After the build process is finished, open the Solution Explorer window in Visual Studio if you don't already have it open. View menu -> Solution Explorer.as28.postimg.org_sbkyfiz9p_image.png

Inside your Solution Explorer right click your Scripts project and select Properties.as28.postimg.org_92nvpif4d_image.png

Go to the Debug tab on the left and select 'Start external program:' and click the '...' button to the right of that.as28.postimg.org_8foyzzi8d_image.png

On the Select File dialog select ServUO.exe from your project folder and click Open.as28.postimg.org_c6yjmavwt_image.png

You should see the path appear next to 'Start external program:' Now place '-debug' into the 'Command line arguments:' section.as28.postimg.org_ub1k6xtl9_image.png

Now you can save your changes by using the Save button on the toolbar or by using File menu -> Save All. ServUO is now setup for debugging through Visual Studio.

Now I will show you some basics by debugging the StaffOrb.cs. Find and open StaffOrb.cs in the Solution Explorer by double clicking it (Scripts/Items/- Staff Items/). Now find the OnDoubleClick method and place the text editor caret on the first 'if' statement inside that method. Open the Debug menu and select 'Toggle Breakpoint' (this can also be done by clicking the far left of the line in the text editor where the breakpoint icon appears).as28.postimg.org_isgbj6i31_image.png

You should see a red circle on the far left showing that you have a Breakpoint like this.as28.postimg.org_jw0fv52q5_image.png

Now right click your Scripts project in the Solution Explorer. Select the 'Debug' menu and 'Start new instance'.as28.postimg.org_5fd6gkd8t_image.png

Visual Studio will now rebuild your project and after that is done you should see ServUO server launch. Now log into your server through UO and give yourself a StaffOrb if you don't already have one and double click it. UO should now freeze not letting you play any more and Visual Studio should be stopped on the breakpoint you set.as28.postimg.org_py82lmr65_image.png

You can now step through the code line by line by pressing the F11 key (default for C# environment) or using the debug icons on the toolbar or Debug Menu. You can hover over variables with your mouse and it will pop up a display to show what their current values are like I did with '' below.as28.postimg.org_ixk2supe5_image.png

Step through the code and line for line and watch what's going on. This allows you to see why bits of code might not run, what the variables are and what you expect them to be, ect.

You can stop stepping line for line and let the server go back to running like normal until it hits another breakpoint by pressing the F5 key (default for C# environment) or using the debug icons on the toolbar or Debug Menu.

This pretty much concludes this tutorial and I would suggest reading up more on Visual Studio debugging on the web as there are tons more things that can be done besides the basics I showed.
Last edited:
Excellent work and Thank you so very much for putting this together Kalamus i have no doubts that this will help many people for a long time.
other then some minor hiccups that were out of Kalamus's control with the images.
For those of you using the express version of Visual Studio, you will not see the Start External Program option in the Debug Tab under your project:

As usual, the express version requires addition work to accomplish things that are easily done in the full version of Visual Studio. To enable the Start External Program, you'll need to open up Scripts.csproj in your Scripts folder and make the following edit:

Under this line
 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">

Put the following, but make sure you update the path of servUO.exe to match your path!