How to: Get Source Code Using Source Server

This topic applies to:

Edition

Visual Basic

C#

C++

Web Developer

Express

Topic applies Topic applies Topic applies Topic applies

Pro, Premium, and Ultimate

Topic applies Topic applies Topic applies Topic applies

When there is no source code on the local machine or the PDB file does not match the source code, you can use Source Server to help debug an application. Source Server takes requests for files and returns the actual files. Source Server runs by means of a DLL file named srcsrv.dll. Source Server reads the application's PDB file, which contains pointers to the source code repository, as well as commands used to retrieve source code from the repository. You can limit what commands are allowed to be executed from the application's PDB file by listing the allowed commands inside a file named srcsrv.ini, which must be placed in the same directory as srcsrv.dll and devenv.exe.

For more information about connecting to and using a Source Server, see Source Server.

Security noteSecurity Note

The following potential security threats must be taken into account when using Source Server: Arbitrary commands can be embedded in the application's PDB file, so make sure you put only the ones you want to execute in the srcsrv.ini file. Any attempt to execute a command not in the srcsvr.ini file will cause a confirmation dialog box to appear. For more information, see Security Warning: Debugger Must Execute Untrusted Command.No validation is done on command parameters, so be careful with trusted commands. For example, if you trusted cmd.exe, a malicious user might specify parameters that would make the command dangerous.

Procedure

To enable use of Source Server

  1. Ensure that you have complied with the security measures described in the previous section.

  2. On the Tools menu, click Options.

    The Options dialog box appears.

  3. In the Debugging node, select General.

  4. Select the Enable source server support check box.

  5. You can also click the Print source server diagnostic messages to the Output window check box.