1

I'm new to ASP.net programming (not programming in general) and are following a course online.

I have a big problem, that seems to be in Visual Studio, probably with the NuGet package manager.

The problem resides in, that I install the packages, but I can't use them.

Here is an example.

I have installed the Entity framework in my class library:

Solution Explore picture

And my CSPROJ also looks ok to me:

<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netcoreapp3.1</TargetFramework> </PropertyGroup> <ItemGroup> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.1"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.1" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\OdeToFood.core\OdeToFood.Core.csproj" /> </ItemGroup> </Project> 

When I run the dotnet ef command in the project, I get:

PS H:\Pluralsight\asp.net core\OdeToFood\OdeToFood\OdeToFood.Data> dotnet ef Could not execute because the specified command or file was not found. Possible reasons for this include: * You misspelled a built-in dotnet command. * You intended to execute a .NET program, but dotnet-ef does not exist. * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH. 

Also, an error in the Package Manager Console.

And if I run dotnet -h ef it doesn't show under SDK, but it did in the course video I'm following.

I have:

  • The newest version of VS
  • Rebuild the solution and the class library
  • Restarted VS
  • The latest stable version of the packages

It was also a problem when I did it with Font Awesome, but I installed that as a client-side library with Libman instead, because I didn't want to fight with it anymore at that time. But, I really want my package manager to work.

2
  • github.com/OdeToCode/…: "Starting in 3.0, the dotnet ef command-line tool is no longer included in the .NET Core SDK. Before you can execute EF Core migration or scaffolding commands, you’ll have to install this package as either a global or local tool. To install the latest version as a global tool, use the following command: dotnet tool install --global dotnet-ef". Commented Dec 23, 2020 at 23:45
  • So it looks like you're following a course made 2 years ago, in which time about everything about .NET Core changed. Commented Dec 23, 2020 at 23:46

0