It’s clear that Microsoft wants all of us to use TFS. The reality is, that won’t happen. Using a build server other than TFS adds some complications that just simply shouldn’t exist. I spent over three hours today working through the various issues of my first MVC4 project. Allow me to regurgitate the issues and fixes so that you may be better prepared and have fewer issues.
Step 1: Install the .Net 4.5 Runtimes. This is easy via a download from the Microsoft web site.
Step 2: Install the Team City upgrade that supports .Net 4.5. Again, easy through a link on the JetBrains web site.
Step 3: Create Team City project. Check.
Step 4: Click Run. Uhoh. Lots of errors.
The first one to tackle is a missing reference to System.Web.Mvc. How can that not be found? I installed the .Net Framework. Well…it’s actually not part of the framework. I then tweeted, “First .Net 4.5 build fails on build server. Looks like some .Net assemblies are missing.”. Peter Ritchie replied with a link to a blog post from Marc Gravel. The comments in that post suggest to copy the files from your local install to the build server. I that, then reran the build. Still missing references to System.Web.Mvc.
I jumped up to the Asp.Net web site to grab the install, but group security policies prohibited the Web Platform Installer from running on the server. I did a web search for “download MVC4″ and found this link to get it. I downloaded that, installed it on the build server and reran the build. System.Web.Mvc was found. I got past that error, but now a new one saying that a build task was missing for the database project.
Ugh. Why, oh why, can’t Microsoft have a single download with everything you need for a non-TFS build server? More web searching yielded this post on what you need and links to download everything. OK, more grumbling about Microsoft not including everything needed. I get the files and following the instructions on the link. Except that I can’t do step 5. The folder doesn’t exist. Let’s try it anyway. I run the build and the database errors are gone. But now there are new ones about missing the AutoMapper assembly.
The AutoMapper DLL is sitting in the bin folder on my local drive. It makes sense that the DLL is missing. The entre bin folder is ignored and not pushed to the Git server. What if there are other assemblies in that same folder that I need? So, I fire-up Visual Studio and do a Build -> Clean. Sure enough, there are a few assemblies that are still there then tweet a gripe about this. Paul Stack if I was using bindeployable assemblies. No, I’m not. IMO, it shouldn’t be my responsibility to do this, except with my own internal assemblies. If I NuGet a package (looking at you, AutoMapper), it should install into the bindeployable folder of the project.
I copy the assemblies from my local bin folder to the build server and rerun the build. And…it works. I finally have the build running on the build server. Total time over three hours to get this project running.
What’s the solution to all this? First, Microsoft should have a single download package that includes EVERYTHING needed to build a project on the build server. By this, I mean all the Microsoft assemblies, including MVC and database projects. Short of this, provide a SINGLE page that can be EASILY found that lists what you’ll need and links to download it.
Second, NuGet pacakges should get deployed to the bindeployable folder, not just the bin folder. This way, you can easily check them in to your version control system.