Nuget error "Object reference not set to an instance of an object" while installing Entityframework 7 from Package Manager Console in VS2015
Asked Answered
N

12

30

I am trying to build a sample application using EF7 and mvc 6 in visual studio 2015 pre release.

While installing both EF7 and MVC6 using package manager console getting this error.

 PM> Install-Package EntityFramework.Commands -Version 7.0.0-beta3 -Pre
 Attempting to gather dependencies information for package    
 'EntityFramework.Commands.7.0.0-beta3' with respect to project
 targeting '.NETFramework, Version=v4.5.3' Install-Package : Object
 reference not set to an instance of an object. At line:1 char:1
 + Install-Package EntityFramework.Commands -Version 7.0.0-beta3 -Pre
 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
     + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Can any one help me how to resolve this issue, or I am doing right?

Nerte answered 21/4, 2015 at 5:21 Comment(5)
Make sure you update your Nuget extension. There are quite a few known issues with Nuget 3.Anglicize
@Anglicize I have updated nuget version its 3.0.60225.100.Nerte
Has anyone find a solution to this issue?Grapefruit
@Grapefruit I have answered my question below once you disable "api.nuget.org/v3" from the package source, it will solve this problem, let me know you need more help.Nerte
I had same issue and I have solved by restarting visual studio 2015Dynel
N
9

I have solved this problem, by disabling the "https://api.nuget.org/v3/" from the package source, in order to do this, Choose Tools > Nuget Package Manager > Package Source

And other thing I did is added myget package source "https://www.myget.org/F/aspnetvnext/api/v2/"

Following the steps Choose Tools > Nuget Package Manager > Package Source > Click add on top of the window and add the myget package source.

Nerte answered 6/5, 2015 at 7:22 Comment(1)
Or just add the clear tag in your configuration :-) <packageSources> <clear /> <add key="nuget.org" value="api.nuget.org/v3/index.json" protocolVersion="3" /> </packageSources>Broca
S
18
  1. Tools > NuGet Package Manager > Package Manager Settings
  2. Clear All NuGet Caches
  3. Restart Visual Studio
Septuagesima answered 30/12, 2021 at 22:0 Comment(1)
If you do this approach, consider making a backup of your projects packages folder.Chronologist
N
9

I have solved this problem, by disabling the "https://api.nuget.org/v3/" from the package source, in order to do this, Choose Tools > Nuget Package Manager > Package Source

And other thing I did is added myget package source "https://www.myget.org/F/aspnetvnext/api/v2/"

Following the steps Choose Tools > Nuget Package Manager > Package Source > Click add on top of the window and add the myget package source.

Nerte answered 6/5, 2015 at 7:22 Comment(1)
Or just add the clear tag in your configuration :-) <packageSources> <clear /> <add key="nuget.org" value="api.nuget.org/v3/index.json" protocolVersion="3" /> </packageSources>Broca
C
9

I had a similar issue in Visual Studio 2015 Community Edition.

Created a simple ASP.NET MVC 5 default project that I hosted on Azure. I was working through the project and when I tried to load up the NuGet GUI but kept getting the "Object Reference..." error.

I restarted Visual Studio in Administrator mode (right-clicked Visual Studio and started in Administrator mode) which resolved the problem.

Crasis answered 16/11, 2015 at 1:45 Comment(0)
D
4

I solved my problem by adding:

https://api.nuget.org/v3/index.json

as a Package Sources feed, as shown on the picture below:

enter image description here

Dinothere answered 15/5, 2016 at 18:13 Comment(1)
Turning the package sources on and off can also fix the issue. Some providers or network policies may block access to nuget.org.Honkytonk
A
3

My problem solved by activation Microsoft and .NET source , and use it to get package.

enter image description here

enter image description here

Arrowy answered 10/1, 2017 at 10:29 Comment(0)
H
2

What I had is that I was disconnected from the internet while trying to install any package.

Not sure if this covers everyting, but I have to say nuget and the package manager console is a great source for headaches.

Hispaniola answered 11/9, 2015 at 11:33 Comment(1)
Care to explain the downvote? It will cause OP's error.Hispaniola
R
1

For me, after consolidating nugets in the different projects in the solution (through the Consolidate tab), it started to work.

Ransack answered 20/10, 2020 at 13:35 Comment(0)
B
0

In my case, i was having:

Object reference not set to an instance of an object

From package manager and i solved it closing all and opening again.

Brumbaugh answered 27/7, 2016 at 20:11 Comment(0)
M
0

After I restarted the computer, the problem is gone.

Marvellamarvellous answered 30/9, 2019 at 20:36 Comment(0)
F
-1

I think your IPaddress doesn't connect to nugetpackage Use proxy to change your IPaddress I think that's true.

Farouche answered 22/4, 2018 at 14:0 Comment(0)
E
-1

In .Net Core projects I was able to manually edit new version of required package in all projects to avoid the error, i.e.

 <PackageReference Include="Flurl.Http" Version="4.0.2" />

It maybe the same issue that was solved through the Consolidate tab in Max answer

Echoechoic answered 7/6, 2024 at 6:7 Comment(0)
M
-3

Perfect and ultimate Solution Guys this is the perfect solution for that. First install the latest version of nuget (Nuget.VisualStudio) from your visual studio. Then install the sqlite through the last version of nuget you installed already. for more details just look the picture bellow. Thanks

enter image description here

Madder answered 13/2, 2019 at 19:36 Comment(1)
This package is for working with nuget service in Visual studio and it is not related to the problemChaparral

© 2022 - 2025 — McMap. All rights reserved.