c# - Visual Studio 编译错误 - 计算机中缺少 nuget 包,但 nuget restore 说所有包都已安装?
问题描述
这是一个简单的错误,但令人沮丧?我的项目不会重建/编译。错误是:
Severity Code Description Project File Line Suppression State
Error This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is .\packages\Microsoft.Net.Compilers.1.2.1\build\Microsoft.Net.Compilers.props. Microsoft.Bot.Sample.LuisBot C:\Users\jmatson\Downloads\retail-info-bot-src\Microsoft.Bot.Sample.LuisBot.csproj 229
所以我尝试了一个 nuget restore 并得到:
All packages are already installed and there is nothing to restore. Time Elapsed: 00:00:00.0455939
========== Finished ==========
那么谁是对的,谁是错的,这又是如何解决的呢?:/
解决方案
Visual Studio 编译错误 - 计算机中缺少 nuget 包,但 nuget restore 说所有包都已安装?
首先,确保您没有将\packages
文件夹添加到源代码管理中。如果您添加了它,请将其从源代码管理中删除。
其次,如果您没有使用源代码管理或没有将该文件夹添加到源代码管理中,但仍然存在此问题,则应删除Microsoft.Net.Compilers.1.2.1
该\packages
文件夹中的包,然后在包管理器控制台中使用 NuGet 命令行:
Update-Package -reinstall
强制将包引用重新安装到项目中。
文件Microsoft.Net.Compilers.props
位置更改或包文件夹中缺少文件将导致此问题。换句话说,该文件Microsoft.Net.Compilers.props
缺少包文件夹但包在那里,您将收到该错误。
在这里检查类似的问题。
希望这可以帮助。
推荐阅读
- julia - 从 TimePeriod 和 StartDate 创建 Julia 日期时间
- sparql - SPARQL 用于所有列和行的唯一值集
- sql - Oracle 12c - 插入多个 case 条件
- arrays - 在 Fortran 中声明虚拟参数显式形状数组
- ruby-on-rails - Rails - activerecord model serializer group results by specific column in the foreign table
- javascript - Remove self element onclick
- excel - 对“条件”排序线进行故障排除
- python - 使用 python 进行 Selenium Web 抓取 - 没有名称的任何下拉菜单
- pandas - 'int' 对象在 python3.x 中没有属性 'replace' 错误
- node.js - 如何在函数解析服务器中发出 POST 请求