Install dotnet ef success but when call it hit error - .net-core

Error: A fatal error occurred. The required library libhostfxr.so could not be found. If this is a self-contained application, that library should exist in [/home/alanee/.dotnet/tools/.store/dotnet-ef/3.1.3/dotnet-ef/3.1.3/tools/netcoreapp3.1/any/]. If this is a framework-dependent application, install the runtime in the global location [/usr/share/dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [/etc/dotnet/install_location].
The .NET Core runtime can be found at: - https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=ubuntu.20.04-x64
My current dotnet info is: .NET Core SDK (reflecting any global.json): Version: 3.1.201 Commit: b1768b4ae7
Runtime Environment: OS Name: ubuntu OS Version: 20.04 OS Platform: Linux RID: linux-x64 Base Path: /snap/dotnet-sdk/69/sdk/3.1.201/
Host (useful for support): Version: 3.1.3 Commit: 4a9f85e9f8
.NET Core SDKs installed: 3.1.201 [/snap/dotnet-sdk/69/sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.App 3.1.3 [/snap/dotnet-sdk/69/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.3 [/snap/dotnet-sdk/69/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download

make the configuration below and use the latest version of dotnet-ef:
export PATH="$PATH:$HOME/.dotnet/tools"
export DOTNET_ROOT=/snap/dotnet-sdk/current
export MSBuildSDKsPath=$DOTNET_ROOT/sdk/$(${DOTNET_ROOT}/dotnet --version)/Sdks
export PATH="${PATH}:${DOTNET_ROOT}"
export PATH="$PATH:$HOME/.dotnet/tools"

Related

High CPU usage in VBCSCompiler after update .NET 6 to .NET 7

I have ASP NET Core Web App and after I update .NET 6 to .NET 7 I get High CPU usage in VBCSCompiler when deploy my app in docker
dotnet --info output
`.NET SDK:
Version: 7.0.102
Commit: 4bbdd14480
Runtime Environment:
OS Name: ol
OS Version: 8
OS Platform: Linux
RID: ol.8-x64
Base Path: /usr/lib64/dotnet/sdk/7.0.102/
Host:
Version: 7.0.2
Architecture: x64
Commit: d037e070eb
.NET SDKs installed:
7.0.102 [/usr/lib64/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 7.0.2 [/usr/lib64/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.2 [/usr/lib64/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
DOTNET_ROOT [/usr/lib64/dotnet]
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:`
Here is what i get
run dotnet app and get this problem.

Missing `Microsoft.AspNetCore.App` of version `2.2.8` on `Ubuntu 20.04` after clean installation

Having issues with Ubuntu 20.04. I followed official instruction and installed both SDK & runtime. If can be confirmed from the terminal:
dotnet --list-sdks
3.1.403 [/usr/share/dotnet/sdk]
and runtime:
dotnet --list-runtimes
Microsoft.AspNetCore.App 3.1.9 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.9 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
...yet the project I am trying to dotnet run requires the Microsoft.AspNetCore.App 2.2.8 as can be seen from the log:
It was not possible to find any compatible framework version
The framework 'Microsoft.AspNetCore.App', version '2.2.8' was not found.
- The following frameworks were found:
3.1.9 at [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
You can resolve the problem by installing the specified framework and/or SDK.
The specified framework can be found at:
- https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=2.2.8&arch=x64&rid=ubuntu.20.04-x64
What's the correct way to install missing SDKs and runtimes?
So it comes out that Ubuntu 20.04 is not supported for above-mentioned runtime and one have to install them manually.
In my particular case it was enough to download binaries and run them as usual.

Running dotnet core application (dll) without SDK

I'm trying to get my dotnet Core application running on an ubuntu 18.04LTS machine with dotnet core runtime installed.
The command:
dotnet myapp.dll
The result:
Did you mean to run dotnet SDK commands? Please install dotnet SDK from:
https://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
As far as I understand I do not need the SDK for simply running this application. Just the runtime should suffice, right?
dotnet --info
Host (useful for support):
Version: 2.2.8
Commit: b9aa1abc51
.NET Core SDKs installed:
No SDKs were found.
.NET Core runtimes installed:
Microsoft.NETCore.App 2.2.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
How to make this work without installing an SDK?
It actually worked. I was running the dotnet command with the wrong path.. myapp.dll was nested a bit deeper. My mistake.

Unable to resolve 'Microsoft.EntityFrameworkCore.SqlServer (>= 3.0.0)' for '.NETCoreApp,Version=v3.0'

Good day,
I am trying to add a package named 'Microsoft.EntityFrameworkCore.SqlServer --version 3.0.0' in my ASP.NET Core Blazor application in VS Code. But I am getting the following error.
P.s. This is my first time working with VS Code.
Terminal
g:\Workspace\Test>dotnet add package Microsoft.EntityFrameworkCore.SqlServer --version 3.0.0
Writing C:\Users\dell\AppData\Local\Temp\tmpDB70.tmp
info : Adding PackageReference for package 'Microsoft.EntityFrameworkCore.SqlServer' into project 'g:\Workspace\Test\Test.csproj'.
info : Restoring packages for g:\Workspace\Test\Test.csproj...
error: Unable to resolve 'Microsoft.EntityFrameworkCore.SqlServer (>= 3.0.0)' for '.NETCoreApp,Version=v3.0'.
error: Package 'Microsoft.EntityFrameworkCore.SqlServer' is incompatible with 'all' frameworks in project 'g:\Workspace\Test\Test.csproj'.
.NET Info
g:\Workspace\Test>dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.0.100
Commit: 04339c3a26
Runtime Environment:
OS Name: Windows
OS Version: 6.1.7601
OS Platform: Windows
RID: win7-x64
Base Path: C:\Program Files\dotnet\sdk\3.0.100\
Host (useful for support):
Version: 3.0.0
Commit: 95a0a61858
.NET Core SDKs installed:
3.0.100 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
.csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
</Project>
A couple of posts suggested that I clear Nuget cache which I did. But still in vain.
g:\Workspace\Test>dotnet nuget locals all --clear
info : Clearing NuGet HTTP cache: C:\Users\dell\AppData\Local\NuGet\v3-cache
info : Clearing NuGet global packages folder: C:\Users\dell\.nuget\packages\
info : Clearing NuGet Temp cache: C:\Users\dell\AppData\Local\Temp\NuGetScratch
info : Clearing NuGet plugins cache: C:\Users\dell\AppData\Local\NuGet\plugins-cache
info : Local resources cleared.
g:\Workspace\Test>dotnet restore --force
Restore completed in 50.68 ms for g:\Workspace\Test\Test.csproj.
Thanks in advance.
If you are using any Visual studio IDE, try to delete/cut the nuget config file somewhere else.

Upgrading to .NET Core 3 in project that also uses netstandard2.1 is not building in Rider

I'm running on a macOS and the project I'm working on just upgraded from .NET Core 2 to .NET Core 3. The problem is that I can no longer build my project in Rider. If I try to build it in the terminal using dotnet build, the build succeeds. In my project, there are some subprojects that use netstandard2, but this should not be a problem (as its working in the terminal). I'm getting the following error message:
Project1 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Project2 supports: netstandard2.1 (.NETStandard,Version=v2.1)
I have tried to add a global.json file which specifies I'm using version 3 of .NET Core, but it didn't help.
If I'm running dotnet build once in the terminal, then the new build of Rider will succeed. So things are working, but it is just annoying to always build in the terminal first.
The output of dotnet --info:
dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.0.100
Commit: 04339c3a26
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.14
OS Platform: Darwin
RID: osx.10.14-x64
Base Path: /usr/local/share/dotnet/sdk/3.0.100/
Host (useful for support):
Version: 3.0.0
Commit: 7d57652f33
.NET Core SDKs installed:
2.2.300 [/usr/local/share/dotnet/sdk]
2.2.401 [/usr/local/share/dotnet/sdk]
2.2.402 [/usr/local/share/dotnet/sdk]
3.0.100 [/usr/local/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
I found that the issue was in Rider. The workaround is to change PackageReference Restore Engine (in File > Settings > Build, Execution, Deployment > NuGet) to MSBuild.
The issue will be fixed in a later version of Rider, so it is recommended to switch back to Embedded after the version is relased. The difference between MSBuild and Embedded:
MSBuild just calls external MSBuild task; Embedded directly calls
NuGet API inside Rider process. Embedded should work much faster and
it provides additional logs which can be useful when restore fails
The reason for the issue:
[...] because Rider 2019.2 EAP2 still used NuGet 4.9 internally; this
version doesn't have proper support of .NET Core 3.0 / .NET Standard
2.1. In Rider 2019.2 RTM, we are going to upgrade the internal version of NuGet up to 5.1.
Source for quotes and screenshot:
https://youtrack.jetbrains.com/issue/RIDER-29888

Resources