R – Using the ASP Compiler in NAnt to build an ASP .Net MVC application

asp.netasp.net-mvccompiler-constructionnant

I am succesfully building ASP .Net applications in NAnt using the ASP Compiler, without a problem., as part of my Continuous Integration process.

However, if I try exactly the same process on an ASP .NET MVC application, the build fails in NAnt, but will compile succesfully in Visual Studio. The error message I get in NAnt is:

[HttpParseException]: Could not load type 'MyNamespace.Views.Home.Index'

which appears that it has a problem with the dots in the filenames, but I might be wrong.

Any suggestions are most welcome.

Best Answer

You shouldn't install ASP.NET MVC onto the build box. You should be referencing the System.Web.MVC, System.Web.Routing and System.Web.Abstractions DLLs from wherever you store your third-party references. We normally have a /lib folder for all references where we have those 3 DLLs (and many more) stored and a /src folder where all of our code lives. If you are referencing these DLLs this way, you no longer have to rely on the environment for those DLLs. This blog post explains this idea in more detail.