visual-studio-2010asp.net-mvc-3nugetvisual-studio-templates

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 :

<WizardData>
    <packages>
        <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" />
    </packages>
</WizardData>

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

<WizardData>
    <packages>
        ...
        <package id="elmah" version="1.2.0.1" />
    </packages>
</WizardData>

I've also downloaded and added elmah.1.2.0.1.nupkg 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 :

error
(source: free.fr)

Does anyone knows how to solve this error?

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


Solution

  • 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.