我正在尝试进入我的软件包管理器控制台,它给了我以下错误:
An error occurred while reading file 'C:\Users\rein.shope\Documents\Visual Studio 2015\Projects\Vidly\Vidly\packages.config': Null or empty package id
错误显示在窗口顶部的功能区中(“恢复”按钮在单击时不执行任何操作)和窗口内的红色文本。控制台不允许我输入命令。
packages.config
的内容:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package Id="Antlr" version="3.4.1.9004" targetFramework="net452" />
<package Id="bootstrap" version="3.0.0" targetFramework="net452" />
<package Id="EntityFramework" version="6.1.3" targetFramework="net452" />
<package Id="jQuery" version="1.10.2" targetFramework="net452" />
<package Id="jQuery.ValIdation" version="1.11.1" targetFramework="net452" />
<package Id="Microsoft.ApplicationInsights" version="2.0.0" targetFramework="net452" />
<package Id="Microsoft.ApplicationInsights.Agent.Intercept" version="1.2.1" targetFramework="net452" />
<package Id="Microsoft.ApplicationInsights.DependencyCollector" version="2.0.0" targetFramework="net452" />
<package Id="Microsoft.ApplicationInsights.JavaScript" version="0.22.9-build00167" targetFramework="net452" />
<package Id="Microsoft.ApplicationInsights.PerfCounterCollector" version="2.0.0" targetFramework="net452" />
<package Id="Microsoft.ApplicationInsights.Web" version="2.0.0" targetFramework="net452" />
<package Id="Microsoft.ApplicationInsights.WindowsServer" version="2.0.0" targetFramework="net452" />
<package Id="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" version="2.0.0" targetFramework="net452" />
<package Id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net452" />
<package Id="Microsoft.AspNet.Identity.EntityFramework" version="2.2.1" targetFramework="net452" />
<package Id="Microsoft.AspNet.Identity.Owin" version="2.2.1" targetFramework="net452" />
<package Id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net452" />
<package Id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net452" />
<package Id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net452" />
<package Id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net452" />
<package Id="Microsoft.CodeDom.ProvIders.DotNetCompilerPlatform" version="1.0.0" targetFramework="net452" />
<package Id="Microsoft.jQuery.Unobtrusive.ValIdation" version="3.2.3" targetFramework="net452" />
<package Id="Microsoft.Net.Compilers" version="1.0.0" targetFramework="net452" developmentDependency="true" />
<package Id="Microsoft.Owin" version="3.0.1" targetFramework="net452" />
<package Id="Microsoft.Owin.Host.SystemWeb" version="3.0.1" targetFramework="net452" />
<package Id="Microsoft.Owin.Security" version="3.0.1" targetFramework="net452" />
<package Id="Microsoft.Owin.Security.Cookies" version="3.0.1" targetFramework="net452" />
<package Id="Microsoft.Owin.Security.Facebook" version="3.0.1" targetFramework="net452" />
<package Id="Microsoft.Owin.Security.Google" version="3.0.1" targetFramework="net452" />
<package Id="Microsoft.Owin.Security.MicrosoftAccount" version="3.0.1" targetFramework="net452" />
<package Id="Microsoft.Owin.Security.OAuth" version="3.0.1" targetFramework="net452" />
<package Id="Microsoft.Owin.Security.Twitter" version="3.0.1" targetFramework="net452" />
<package Id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
<package Id="Modernizr" version="2.6.2" targetFramework="net452" />
<package Id="Newtonsoft.Json" version="6.0.4" targetFramework="net452" />
<package Id="Owin" version="1.0" targetFramework="net452" />
<package Id="Respond" version="1.2.0" targetFramework="net452" />
<package Id="WebGrease" version="1.5.2" targetFramework="net452" />
</packages>
所有Id
字段似乎都完好无损。 Google搜索不会为“null或空包ID”返回任何内容。
答案 0 :(得分:25)
尝试将所有Id
更改为id
(小写)。它为我解决了。
答案 1 :(得分:0)
我还不能发表评论,所以我将为这个帖子的未来访问者写一个答案。我有同样的错误消息,但是问题是文件中的id
更改为ids
。我把它改回来,它也为我解决了这个问题。
答案 2 :(得分:0)
我遇到了同样的问题,奇怪的是,这是packages.config发生的事情
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package MovieID="Antlr" version="3.5.0.2" targetFramework="net472" />
<package MovieID="bootstrap" version="3.4.1" targetFramework="net472" />
<package MovieID="jQuery" version="3.3.1" targetFramework="net472" />
<package MovieID="jQuery.ValiMovieIDation" version="1.17.0" targetFramework="net472" />
<package MovieID="Microsoft.AspNet.Mvc" version="5.2.7" targetFramework="net472" />
<package MovieID="Microsoft.AspNet.Razor" version="3.2.7" targetFramework="net472" />
<package MovieID="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net472" />
<package MovieID="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net472" />
<package MovieID="Microsoft.CodeDom.ProvMovieIDers.DotNetCompilerPlatform" version="2.0.0" targetFramework="net472" />
<package MovieID="Microsoft.jQuery.Unobtrusive.ValaMovieIDation" version="3.2.11" targetFramework="net472" />
<package MovieID="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net472" />
<package MovieID="Modernizr" version="2.8.3" targetFramework="net472" />
<package MovieID="Newtonsoft.Json" version="11.0.1" targetFramework="net472" />
<package MovieID="WebGrease" version="1.6.0" targetFramework="net472" />
</packages>
请注意,所有d个字母都会变成MovieID 我认为这是一个错误,我正在使用VS community 2019最新版本 您可以手动修复
答案 3 :(得分:0)
我猜这是由于 resharper 或一些类似的工具造成的。最初,我重命名了变量名,然后 resharper 将其应用于项目中的所有文件,甚至是 packages.config。 所以最好照顾好这个功能:)
重命名回 id
解决了这个问题