本文介绍了切换回packages.config的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以切换回 packages.config 方案?我在创建项目时改用 PackageReference 方案,但由于某些原因现在需要改用旧方式.

Is it possible to switch back to packages.config scheme of things? I moved to PackageReference scheme when I created the project, but for some reasons need to move to old way of things now.

我尝试过包管理器控制台命令,例如使用 UpdateReinstall 选项进行恢复.他们不再生成packages.config.我还切换了 Tools >选项 >NuGet 包管理器packages.config.不好.

I have tried Package Manager Console commands like restore with Update and Reinstall options. They do not generate packages.config anymore. I also switched Tools > Options > NuGet Package Manager to packages.config. No good.

推荐答案

您需要:

  1. 向项目添加空"packages.config 文件(即 示例 但没有单独的 元素)
  2. 卸载项目或关闭 vs 并在文本编辑器中打开 csproj 文件.
  3. 从项目文件中删除所有 PackageReference 元素.
  4. 确保未在项目文件中设置 .
  5. 在 VS 中重新打开项目.
  1. Add an "empty" packages.config file to the project (that is, xml as in the example but without individual <package> elements)
  2. Unload the project or close vs and open the csproj file in a text editor.
  3. Remove all PackageReference elements out of the project file.
  4. Make sure that <RestoreProjectStyle> is not set in the project file.
  5. Reopen the project in VS.

这篇关于切换回packages.config的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 02:51