Automatically install NuGet packages in VS 2010 project template

Can someone share with me how (or where I can find how to install) NuGet packages automatically when I create a new project based on my custom project template in Visual Studio 2010?

I am creating a new project template for a project that uses a pair of NuGet packages by default. I read the documentation on the NuGet website, but this is not acceptable as I want to reference an existing package if it is already installed in the project.

In other words, if I embed v1 package in my template (VSIX), but version 1.1 is already installed in the solution, I want NuGet to reference version 1.1 instead of embedding v1 in the solution and forcing the developer to update the package.

Is it possible? And if so, how?

+4
source share
2 answers

NuGet 1.5 now supports this feature without requiring the creation of an ASP.NET MVC 3 project template.

http://blogs.msdn.com/b/marcinon/archive/2011/07/08/project-templates-and-preinstalled-nuget-packages.aspx

This replaces the post I wrote. :)

+2
source

Check out this post here:

http://haacked.com/archive/2011/06/06/creating-a-custom-asp-net-mvc-project-template.aspx

The article mentioned that NuGet packages should be on your computer, however this should change in the future (if it has not already been).

0
source

All Articles