Greg B
Greg B

Reputation: 813

Update default nuget packages

I understand how to update a package within a solution but my question is how do you update the default packages. IE: When I create a new solution it's at the latest version already instead of having to go not 'Manage packages for solutions' and updating every time I start a new project.

For example: If i create a new MVC4 project, jQuery 1.7.1 is being installed. 1.8.2 has been out since September. I want 1.8.2 installed by default.

Upvotes: 2

Views: 1011

Answers (2)

Deepak
Deepak

Reputation: 2233

Another way could be is to use update-package from the package manager console

http://docs.nuget.org/docs/reference/package-manager-console-powershell-reference#Update-Package

Upvotes: 0

Xavier Decoster
Xavier Decoster

Reputation: 14810

You can change these by modifying the default project templates. You find them here:

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\ProjectTemplates\

For instance, the Web application template for MVC4 using Razor syntax can be found here:

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\ProjectTemplates\CSharp\Web\1033\MvcWebApplicationProjectTemplatev4.0.cshtml

Within this folder, simply modify the .vstemplate XML file contents, in this case:

MvcWebApplicationProjectTemplate.11.cshtml.vstemplate

Look for a section called packages and modify the package versions to the ones you want. The section looks like this:

<WizardData>
        <packages repository="registry" keyName="AspNetMvc4VS11" isPreunzipped="true">
            <package id="EntityFramework" version="5.0.0" skipAssemblyReferences="true" />
            <package id="jQuery" version="1.7.1.1" />
...

Also make sure to update the _references.js file in the Scripts folder, and ensure the packages with the versions you want, are available in the following location:

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

Upvotes: 3

Related Questions