ScriptSharp, System.dll and build errors

Having discovered the excellent ScriptSharp project just a few weeks ago, I began to encounter errors with the project in that sometimes it would cease to build successfully. If you ever encounter the situation where the project would fail to build, but you would receive no build errors in the error log, make sure System.dll has not been added as a project reference.

This reference can be added by Visual Studio automatically (I’m using 2010 here) when you:

  • Add a new class by selecting Add > Class.. from the project context menu
  • Import an existing class from another (non-Script#?) project

.. and there are probably a few more situations, but these are the only ones I encountered.

Initially,I thought the only way to get my project back to a working state was to copy the files out, remove and re-create the project then add all my items back in. However, the real solution is simple; just remove the reference to System.dll and your project should start compiling again.

By the way – if you’re a C# programmer who also plays with Javascript, I highly recommend using Script#. It’s just so top-drawer.