The Framework 'Microsoft.Aspnetcore.App', Version '5.0.0' Was Not Found. When It Is Installed and Inside $Path

The framework 'Microsoft.AspNetCore.App', version '5.0.0' was not found. when it is installed and inside $PATH

I had the same problem. You need to have an ASP.NET runtime.

It's a bit confusing and easily overlooked, but it says you need an Microsoft.AspNetCore.App runtime, and your dotnet --list-runtimes only lists Microsoft.NETCore.Apps.

The ArchWiki mentions:

This is caused because the runtime is shipped as a separate package in Arch. You just need to make sure you have the aspnet-runtime package installed as well.

To install the .NET 5 runtime:

sudo pacman -Sy aspnet-runtime

or if you need the 3.1 version:

sudo pacman -Sy aspnet-runtime-3.1

Now there's an ASP runtime available:

$ dotnet --list-runtimes
Microsoft.AspNetCore.App 5.0.4 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] # <<<
Microsoft.NETCore.App 5.0.4 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

The framework 'Microsoft.NETCore.App', version '5' was not found while Microsoft.NETCore.App 5.0.0 is found

Uninstall deprecated package globally:-

dotnet tool uninstall dotnet-ef -g

And then try to Reinstall the up-to-date package version:-

dotnet tool install --global dotnet-ef --version 5.0.1 

If not work, try to second process:-

So you have already installed .Net 5.

download dotnet-sdk-5.0.301-win-x64.zip and copied Microsoft.AspNetCore.App\5.0.301 folder manually from the zip file to C:\ProgramFiles\dotnet\shared\Microsoft.AspNetCore.App\5.0.301

then hope the asp.net core application will be started working.

Azure Devops Build failing for .Net 5 when using multiple frameworks

The reason your project doesn't build successfully is because the Microsoft-Hosted agent doesn't have the.NET 5.0 SDK installed.

You can download the.NET 5.0 SDK using Use.NET Core Task:

- task: UseDotNet@2
inputs:
packageType: 'sdk'
Version: '{version}'
includePreviewVersions: {true/false}

This task can download a specific version of the .Net SDK from the network and add it to the PATH.

In addition, since you are using multiple versions of .NET in your project, you can use this task to specify which version of.NET you will use in the following tasks.

In other words, this task has two functions:

  1. Download a specific SDK version that is not installed.
  2. Specify which SDK version will be used for the following tasks.

Cannot find command 'dotnet ef'

Note to readers: If you haven't installed dotnet ef, you need to install it first: dotnet tool install --global dotnet-ef. The question-asker already did that. You need to do that first before the rest of this answer can help.

How to fix this

For Linux and macOS, add a line to your shell's configuration:

  • bash/zsh:

    export PATH="$PATH:$HOME/.dotnet/tools/"
  • csh/tcsh:

    set path = ($path $HOME/.dotnet/tools/)

When you start a new shell/terminal (or the next time you log in) dotnet ef should work.

For Windows:

See this question on how to add to the PATH environment variable.

You need to add %USERPROFILE%\.dotnet\tools to the PATH.

What's going on?

The .NET Core 3.0 (preview) version of this failure is much more illuminating:

$ 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 Core 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.

The second and the third one both refer to dotnet trying to find a dotnet-ef command but can't find it. As the third point says, dotnet-ef is not in your path.

Here's what the docs say:

Global Tools can be installed in the default directory or in a specific location. The default directories are:

OS Path

Linux/macOS $HOME/.dotnet/tools

Windows %USERPROFILE%\.dotnet\tools

So, you should add $HOME/.dotnet/tools/ to your $PATH.

But also note this part from docs:

These locations are added to the user's path when the SDK is first run, so Global Tools installed there can be called directly.

So, it sounds like something went wrong. If you installed using a manual tarball, the SDK screwed up and you should report this bug to Microsoft. If you use a distribution package, they screwed up and you should report this as a bug to them.

What could cause an error related to npm not being able to find a file? No contents in my node_modules subfolder. Why is that?

It might be related to corruption in Angular Packages or incompatibility of packages.

Please follow the below steps to solve the issue.

  • Delete node_modules folder manually.
  • Install Node ( https://nodejs.org/en/download ).
  • Install Yarn ( https://yarnpkg.com/en/docs/install ).
  • Open command prompt , go to path angular folder and run Yarn.
  • Run angular\nswag\refresh.bat.
  • Run npm start from the angular folder.

Update

ASP.NET Boilerplate suggests here to use yarn because npm has some problems. It is slow and can not consistently resolve dependencies, yarn solves those problems and it is compatible to npm as well.



Related Topics



Leave a reply



Submit