简体   繁体   中英

packages.config: Null or empty package id

I'm trying to enter my Package Manager Console, and it's giving me the following error:

An error occurred while reading file 'C:\\Users\\rein.shope\\Documents\\Visual Studio 2015\\Projects\\Vidly\\Vidly\\packages.config': Null or empty package id

The error is displayed both in a ribbon on top of the window (with a "Restore" button that does nothing on click) and in red text within the window. The console will not allow me to input commands.

Contents of 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>

All of the Id fields seem to be intact. A Google search returns nothing for "null or empty package id".

Try to change all Id to id (lower case). It solved for me.

I cannot write comments yet, so I will write an answer instead for future visitors of this post. I had the same error message, but the issue was that id was changed to ids in my file. I changed it back and it solved the issue for me, too.

I had the same Problem , strangely this is what happened to 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>

notice that all d letters turn into MovieID I think it's a bug , I'm using VS community 2019 the latest version you can fix it manually

My guess this ocurred due to resharper or some simillar tool. Initially I renamed variable name and resharper applied it to all files in project, even packages.config. So it is better to look after this feature :)

Renaming back to id solved this problem

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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