Launching from Visual Studio

From Valve Developer Community
Revision as of 17:54, 1 January 2010 by Coder0xff (talk | contribs) (New article)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

In this tutorial you will learn how to launch your mod from within Visual Studio, allowing you to quickly test and debug changes. The fictitious mod used in the examples is called MyMod. When following the steps, replace it with the name of your own mod.

Warning.png Warning: This page assumes you are using Visual Studio 2008 (though it may work on others?)
Note.png Note: This page assumes you are building an Orange Box mod, though it may also work my changing from the source sdk base 2007 to source sdk base
Note.png Note: You must have already completed Compiling_under_VS2008, or Compiling_under_VS2005 if appropriate.

Setting the debug command line

  1. Right click the Client project and go to Properties > Configuration Properties > Debugging.
  2. In the Configuration drop down at the top left choose All Configurations.
  3. Select the Command field, click the drop down arrow, and choose Browse...
  4. Navigate to C:\Program Files\Steam\steamapps\your user name\source sdk base 2007\ and select hl2.exe
    Note.png Note: 64 bit computers will use Program Files (x86)
  5. Select the Command Arguments field. Enter the following, replacing MyMod with your own mods directory:
-allowdebug -game "C:\Program Files\steamapps\SourceMods\MyMod"
Note.png Note: Make sure to include the quotes
  1. Press the OK button.

Launching

There are several ways to begin debugging your mod.

  1. Press F5
  2. Main Menu > Debug > Start Debugging
  3. Find the button in the toolbar that resembles a green play arrow, also displayed as an icon next to the above menu option.

A message will appear indicating that symbols cannot be found for hl2.exe. This simply means that there is no debug information for hl2.exe, but we aren't particularly interested in hl2.exe itself. It is our Client.dll and Server.dll made by our project that we will be debugging. Check Don't show this dialog again and click Yes. Your mod will now load several modules, and several seconds later your mod will appear. It is recommended to edit the video options, and select windowed mode. This will make it easier to switch back and forth between your mod and VS.