Friday, May 30, 2008

Building Projects and Solutions without Visual Studio

In the 2.0 version of the .net framework, Microsoft included a little gem called MSBuild.exe. MSBuild provides a command line interface for compiling entire projects and solutions.

Normally we would maintain NANT build scripts for our projects, and then we would run them on a build server, using CruiseControl .net, as our source control changed. However with this cool tool we can now build the solution directly from the sln file; removing our need to maintain build files.

I did run into a few snags:

J# support

J# is not entirely supported in the 2.0 framework, until you install the j# redistributable (3.7 mb) http://www.microsoft.com/downloads/details.aspx?FamilyId=E9D87F37-2ADC-4C32-95B3-B5E3A21BAB2C&displaylang=en

Web Applications

Web Applications aren't supported in the 2.0 framework. They came as an addition after the initial release of Visual Studio 2005. All of the information about them came with Microsoft® Visual Studio® 2005 Team Suite Service Pack 1. There was really no change required to the framework for these types of projects, it's really only affected Visual Studio, so there is no service pack for the framework.

I tried to download and install the service pack, but it's huge (431 mb) and it won't install:



So when all else fails, start over :)

The error message was:
error MSB4019: The imported project "C:\Program Files\MSBuild\Microsoft\VisualStudio\v8.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
so I just copied the \WebApplication\ folder from a PC with Visual studio installed, and added it into to the directory where it was expecting to find it (which I had to create)

Now everything works great, and life is easier than it was before. Every time I commit a change it is auto deployed to the our dev site and life is good.