简体   繁体   English

包管理器控制台 - 更新特定项目

[英]Package Manager Console - Update a specific project

Quick question regarding the Package Manager Console and the “Update Package” command. 有关Package Manager控制台和“Update Package”命令的快速问题。

I currently have a single solution hosting two MVC 4.0 projects (one of them is Set as Startup Project). 我目前有一个托管两个MVC 4.0项目的解决方案(其中一个是Set as Startup Project)。

When I open the Package Manager Console , I choose the project I want to update from the Default project dropdown and then, I launch the “ Update-Package ” command. 当我打开Package Manager Console ,我从Default project dropdown选择要更新的Default project dropdown ,然后启动“ Update-Package ”命令。

To my surprise, the “ Update-Package ” command does not take into account the project I have selected inside the Default project dropdown but instead, it updates both my MVC 4.0 projects. 令我惊讶的是,“ Update-Package ”命令没有考虑我在Default project dropdown选择的Default project dropdown ,而是更新了我的MVC 4.0项目。

The workaround is to manually specify my project name inside the “Update-Package” command like so: Update-Package -ProjectName Kobo.Portal.Web 解决方法是在“Update-Package”命令中手动指定我的项目名称,如下所示: Update-Package -ProjectName Kobo.Portal.Web

Out of curiosity, does anyone know why the Update-Package command does not take into account the selected/targeted project in the Default project dropdown? 出于好奇,有谁知道为什么Update-Package命令没有考虑默认项目下拉列表中的选定/目标项目?

Is this a known issue? 这是一个已知的问题? Is this by design? 这是设计的吗? What's the purpose of having to choose a Default project if the Package Manager Console won't take it into account? 如果软件包管理器控制台不考虑它,那么必须选择默认项目的目的是什么?

Perhaps my understanding of the Package Manager Console is wrong :-( 也许我对包管理器控制台的理解是错误的:-(

Thanks in advance for anyone shedding some light on this. 提前感谢任何对此有所了解的人。

Sincerely Vince 真诚的文斯

To update a specific project you can specify 要更新您可以指定的特定项目

Update-Package -ProjectName <yourproject>

To get detailed help on the commands in the Package Management console you can type 要获得Package Management控制台中命令的详细帮助,您可以键入

get-help update-package -detailed

to update all existing Nuget packages in 1 project inside your solution. 更新解决方案中1个项目中的所有现有Nuget包。 note that in Package Manager Console autocomplete works for commands and project name and packages 请注意,在包管理器控制台中,自动完成功能适用于命令和项目名称和包

Update-Package -ProjectName Project1 -Reinstall 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM