Thursday, December 30, 2010

My standard .hgignore

One of the things that I do as soon as I am starting on a new project is create either a Git or Mercurial repository for the project.  At the moment I tend to be using Mercurial more that Git, because bitbucket offerss free private repositories.

One of the things you want to do when setting up the repository is add an ignore file so that you don’t add build artefacts and other user specific files to the repository.  You don’t want to add these files as everyone that works on the project will be constantly changing these files which will pollute your history with lots of unnecessary changes that don’t really effect the project at all. 

I thought I might share my current default .hgignore file with you all.  I am curious what other people have in theirs.

# use glob syntax.
syntax: glob


Monday, December 27, 2010

Deploying ASP.NET MVC 3 RC2

I was recently working on a ASP.NET MVC3 proof of concept application.  My client wanted to be able to preview my work with daily builds.  It was suggested that the simplest way for me to go about this would be to deploy it to Azure.  This turned out to work fairly well, but I did have a few dramas getting things to work.

The main problem that I had was making sure that I deployed all of the MVC assemblies along with my app.  This is required as it isn’t part of the .net framework.  I found a few sites indicating which assemblies were needed, but I found I had to add a few more to list before things worked.  This was a frustrating process, because I had to wait 15mins every time a tried something that didn’t work before I knew that it wasn’t going to work. 

To hopefully save others from having the same problem I have included a list of the assemblies I had to deploy along with my app to get it working.  To include a referenced assembly in the deployment make sure that Copy Local option is set to True in the properties of assembly reference.

Without further ado the assemblies you should include are:

  • Microsoft.Web.Infrastructure
  • NuGet.Core
  • System.Web.Helpers
  • System.Web.Mvc
  • System.Web.Razor
  • System.Web.WebPages
  • System.Web.WebPages.Administration
  • System.Web.WebPages.Deployment
  • System.Web.WebPages.Razor
  • WebMatrix.Data

I was quite surprised to see NuGet.Core and WebMatrix.Data in there as I can’t quite see why the MVC framework should have dependencies on these, but my application did fail to start trying to load these assemblies if I didn’t include them, so it would appear that it was necessary.

Tuesday, December 14, 2010

Windows Phone 7 Theme Resources

Recently I have been working on a windows phone 7 application.  In a few of the project template XAML files I noticed references to some StaticResource styles and brushes.  I couldn’t find a nice way in Visual Studio or Expression Blend to see a list of these resources, so I set out to find one on the web.  After a brief search I found the Theme Resources for Windows Phone page on MSDN.  The page lists all of the available resources included in the wp7 theme, but doesn’t show you want the look like.  I decided to make an app which would show the the theme resources to make choosing the correct resource easier.

Please welcome Theme Resource Preview for windows phone 7!

imageA view of the font name resources

The application contains pretty much all of the resources except for the colour resources.  The reason I left the colours out of it is that they seemed to be the same as the brush so figuring out what colour to use shouldn’t be very difficult.

Some more shots of the application in action

I have posted the source code for the application to my bit bucket account so for anyone who is interested you can grab a copy of the source here:

Or for your convenience you can use one of the following hg commands to clone (one is https and the other ssh):

hg clone
hg clone ssh://
The only requirement for the application is that you will need a copy of Visual Studio 2010 and the Windows Phone development tools.  The express version of Visual Studio should to just fine, although I used ultimate.