更新默认的 nuget 包 [英] Update default nuget packages

查看:39
本文介绍了更新默认的 nuget 包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我了解如何在解决方案中更新包,但我的问题是如何更新默认包.IE:当我创建一个新的解决方案时,它已经是最新版本,而不是每次我开始一个新项目时都不必去管理解决方案的包"和更新.

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.

例如:如果我创建一个新的 MVC4 项目,则正在安装 jQuery 1.7.1.1.8.2 已于 9 月发布.我想默认安装 1.8.2.

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.

推荐答案

您可以通过修改默认项目模板来更改这些.您可以在这里找到它们:

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

C:\Program Files (x86)\Microsoft Visual Studio11.0\Common7\IDE\ProjectTemplates\

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

例如,可以在此处找到使用 Razor 语法的 MVC4 的 Web 应用程序模板:

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

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

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

在此文件夹中,只需修改 .vstemplate XML 文件内容,在本例中:

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

MvcWebApplicationProjectTemplate.11.cshtml.vstemplate

MvcWebApplicationProjectTemplate.11.cshtml.vstemplate

查找名为 packages 的部分,然后将软件包版本修改为您想要的版本.该部分如下所示:

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" />
...

还要确保更新 Scripts 文件夹中的 _references.js 文件,并确保具有所需版本的包在以下位置可用:

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

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

这篇关于更新默认的 nuget 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆