How to add a nuget package in a MVC3 project template

I'm trying to hack a MVC 3 project template to automatically install elmah via nuget.

Since MVC 3 Tools update, MVC3 project templates contains this section :

        <package id="jQuery" version="1.5.1" />
        <package id="jQuery.vsdoc" version="1.5.1" />
        <package id="jQuery.Validation" version="1.8.0" />
        <package id="jQuery.UI.Combined" version="1.8.11" />
        <package id="EntityFramework" version="4.1.10331.0" />
        <package id="Modernizr" version="1.7" />

So i've tried to add elmah package like this :

        <package id="elmah" version="" />

I've also downloaded and added elmah. file in

C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Packages

folder along with default packages (jQuery.1.5.1.nupkg, EntityFramework.4.1.10331.0.nupkg etc...)

Unfortunately, i keep having this error when i create a new MVC3 project :

(source: free.fr)

Does anyone knows how to solve this error?

At least is it something feasible with this version of mvc3 tools ?


I just blogged about how to do this: http://haacked.com/archive/2011/06/06/creating-a-custom-asp-net-mvc-project-template.aspx

This walks through creating and registering a custom project template.

How to add a nuget package in a MVC3 project template
See more ...