CyberEgo
CyberEgo

Reputation: 66

Why does calling "get-help entityframework" in the Package Manager Console cause this error?

PM> get-help entityframework

get-help : Object reference not set to an instance of an object.
At line:1 char:1
+ get-help entityframework
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-Help], NullReferenceException
+ FullyQualifiedErrorId : System.NullReferenceException,Microsoft.PowerShell.Commands.GetHelpCommand

I guess it might be a problem related to PowerShell so I've listed its version number here

PM> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      0      10586  494     

And I'm using

Microsoft Visual Studio Community 2017
Version 15.8.7

Upvotes: 3

Views: 4531

Answers (6)

tanuk
tanuk

Reputation: 528

I was using VS2022 and in a solution with a lot of projects. My PM command was not working because my startup project WAS NOT the one with EF, my bad.
(doh)

Upvotes: 0

NodirbekCSdevv
NodirbekCSdevv

Reputation: 51

I had the same problem. Check whether you have Microsoft.EntityFrameworkCore.Tools package installed. I guess you don't have, because I had the same problem when I did not have such package.

After installing Microsoft.EntityFrameworkCore.Tools PM> get-help entityframework Check it again, you will get the result you wanted)

Upvotes: 0

Waseem Sangrasi
Waseem Sangrasi

Reputation: 21

Install Entity Framework Tools first by using the below command.

PM > Install-Package Microsoft.EntityFrameworkCore.Tools

Command line

Upvotes: 2

santi000001
santi000001

Reputation: 21

Installed the NuGet package -> Microsoft.EntityFrameworkCore.Tools

help about_entityframeworkcore

                 _/\__
           ---==/    \\
     ___  ___   |.    \|\
    | __|| __|  |  )   \\\
    | _| | _|   \_/ |  //|\\
    |___||_|       /   \\\/\\

TOPIC about_EntityFrameworkCore

SHORT DESCRIPTION Provides information about the Entity Framework Core Package Manager Console Tools.

LONG DESCRIPTION This topic describes the Entity Framework Core Package Manager Console Tools. See https://docs.efproject.net for information on Entity Framework Core.

The following Entity Framework Core commands are available.

    Cmdlet                      Description
    --------------------------  ---------------------------------------------------
    Add-Migration               Adds a new migration.

    Drop-Database               Drops the database.

    Get-DbContext               Gets information about a DbContext type.

    Remove-Migration            Removes the last migration.

    Scaffold-DbContext          Scaffolds a DbContext and entity types for a database.

    Script-DbContext            Generates a SQL script from the current DbContext. 

    Script-Migration            Generates a SQL script from migrations.

    Update-Database             Updates the database to a specified migration.

SEE ALSO Add-Migration Drop-Database Get-DbContext Remove-Migration Scaffold-DbContext Script-DbContext Script-Migration Update-Database

Upvotes: 0

Mario Levesque
Mario Levesque

Reputation: 1037

Once I installed the NuGet package Microsoft.EntityFrameworkCore.Tools, the error went away and i saw my list...

PM> get-help entityframework

                 _/\__
           ---==/    \\
     ___  ___   |.    \|\
    | __|| __|  |  )   \\\
    | _| | _|   \_/ |  //|\\
    |___||_|       /   \\\/\\

TOPIC about_EntityFrameworkCore

SHORT DESCRIPTION Provides information about the Entity Framework Core Package Manager Console Tools.

LONG DESCRIPTION This topic describes the Entity Framework Core Package Manager Console Tools. See https://docs.efproject.net for information on Entity Framework Core.

The following Entity Framework Core commands are available.

    Cmdlet                      Description
    --------------------------  ---------------------------------------------------
    Add-Migration               Adds a new migration.

    Drop-Database               Drops the database.

    Get-DbContext               Gets information about a DbContext type.

    Remove-Migration            Removes the last migration.

    Scaffold-DbContext          Scaffolds a DbContext and entity types for a database.

    Script-DbContext            Generates a SQL script from the current DbContext. 

    Script-Migration            Generates a SQL script from migrations.

    Update-Database             Updates the database to a specified migration.

SEE ALSO Add-Migration Drop-Database Get-DbContext Remove-Migration Scaffold-DbContext Script-DbContext Script-Migration Update-Database

Upvotes: 5

Peter Whittaker
Peter Whittaker

Reputation: 162

Have you recently upgraded any related components? I ask because another user saw similar behaviour with NuGet after an MVC upgrade: https://github.com/NuGet/Home/issues/2192

Check that your NuGet and Entity Framework packages are up-to-date.

Are there any other strings for which get-help returns a similar error? If not, perhaps go so far as to uninstall and reinstall Entity Framework?

Upvotes: 0

Related Questions