Setting CSharp (C# / CSC.exe) Compiler Defaults

A little known secret about the .NET C# Compiler (CSC.exe) is that it allows us to set ‘global defaults’.

To do this, create a text file called CSC.rsp in one of two places:

  • The current directory (handy for project specific settings)
  • The directory where CSC.exe is stored
    (generally found in C:\Windows\Microsoft.NET\Framework\{version}\csc.exe)

Note that local settings (current directory) will override the global settings.  Also note that there already exists a global CSC.rsp file with the common ‘includes’, you can either add to this, or simply add a setting to this global file that also includes a secondary settings file (more below).

Any command-line switches that you would normally pass to csc.exe can be added in this text file.

If you do not want these settings to be global, but you want to still supply settings in a text file (handy for multi-project settings which you only want to update in one place), just add them to a different named text file and add a command-line argument to csc.exe like so:

csc.exe @{path\to\settings\file.txt} …

If on the other hand you want to explicitly ignore any local or global settings file, simply run csc.exe using the /noconfig argument.


How to Uninstall ContinuousTests

For anyone who has played with Greg Young‘s amazing Visual Studio tool ContinuousTests, you may have discovered that uninstalling it tends to leave a ghosted menu option which seems impossible to remove.  I’m now on a mission to remove this!

Removing it turns out to be quite simple :)

  1. Right-click near your menu bar or speed buttons
  2. Select ‘Customize…’
  3. Select the ‘Commands’ tab
  4. In the list, select ‘ContinuousTests’
  5. Click ‘Delete’

All done :)

It turns out that as at the time of writing, the uninstaller removes all the menu items, but not the menu itself.