简体   繁体   English

ASP.NET Web应用程序和NuGet-未引用程序包更新

[英]ASP.NET Web Application & NuGet - Package Updates Not Referenced

I've got an ASP.NET Web Application (in the formal sense, it's not a "Web Site" project). 我有一个ASP.NET Web应用程序(从正式意义上讲,它不是“网站”项目)。 It references some number of NuGet packages (let's call them all v1.0). 它引用了一定数量的NuGet软件包(我们将其全部称为v1.0)。

If I edit packages.config to reference a newer version of one of the NuGet packages and build, restore packages, or attempt to update the packages everything seems fine. 如果我编辑packages.config以引用其中一个NuGet软件包的较新版本,并构建,还原软件包或尝试更新软件包,则一切似乎都很好。 It downloads the new package, creates a folder for it and the whole deal. 它会下载新软件包,并为其创建一个文件夹并进行整个交易。

The problem comes when I attempt to reference newly added classes or properties within that package. 当我尝试引用该程序包中新添加的类或属性时,就会出现问题。 (Let's call it v2.0.) (我们称它为v2.0。)

IntelliSense doesn't know about them. IntelliSense不了解它们。 When I start trying to figure out why, I find that it's still referencing v1.0. 当我开始尝试找出原因时,我发现它仍在引用v1.0。 It has downloaded 2.0, and the package file asks that it should use 2.0, but unless I explicitly remove the reference to the package and re-add it, VisualStudio seems content to stick with v1.0. 它已经下载了2.0,并且该软件包文件要求使用2.0,但是除非我明确删除对该软件包的引用并重新添加,否则VisualStudio似乎仍然坚持使用v1.0。

I feel like I must be doing something wrong, or at some point in time something has been configured incorrectly, but I'm at a loss as to what that might be. 我觉得我一定在做错事,或者在某个时间点配置不正确,但是我可能会茫然。

Any advice? 有什么建议吗?

You shouldn't update packages.config to get new package versions. 您不应该更新packages.config以获得新的软件包版本。 Package Restore simply downloads the package files. 软件包还原仅下载软件包文件。 It doesn't update references, etc. 它不会更新引用等。

To update a package you can use the Manage NuGet Packages dialog to install updates or use the Package Manager Console and type: Update-Package 要更新程序包,可以使用“管理NuGet程序包”对话框来安装更新或使用程序包管理器控制台并键入: Update-Package

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

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