Running dotnet core application (dll) without SDK - .net-core

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.

Related

Old version of Microsoft.NETCore.App cannot be found at release step

I have an error in my build pipeline on Azure DevOps. The project called DevPortalWeb fails in the Publish step.
The project is upgraded to netcore3.1 (it was created with earlier version).
DevPortalWeb -> C:\agent\_work\13\s\Application\DevPortalWeb\bin\release\netcoreapp3.1\DevPortalWeb.dll
DevPortalWeb -> C:\agent\_work\13\s\Application\DevPortalWeb\bin\release\netcoreapp3.1\DevPortalWeb.Views.dll
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '2.0.0-preview1-002111-00' (x64) was not found.
- The following frameworks were found:
3.1.22 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
5.0.13 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
6.0.1 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.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.NETCore.App&framework_version=2.0.0-preview1-002111-00&arch=x64&rid=win10-x64
C:\agent\_work\13\s\Application\DevPortalWeb\DevPortalWeb.csproj(45,3): error MSB3073: The command "dotnet bundle" exited with code -2147450730.
##[error]Error: The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1
What could be a reason, that the build pipeline requires previous version of the framework? There is no reference to version '2.0.0-preview1-002111-00' in the project now.
The problem was, that project was migrated from .NET Core 2.2 to .NET Core 3.1.
Several packages, including this one, do not target this version anymore. This is already included in version 3.0.
The migration documentation lists which packages are obsolete:
https://learn.microsoft.com/en-us/aspnet/core/migration/22-to-30?view=aspnetcore-6.0&tabs=visual-studio#remove-obsolete-package-references

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.

Install dotnet ef success but when call it hit error

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"

What is dotnet host version?

When i run dotnet --info in the output i get host version: 3.0.3
What is it?
Recently i have installed and later deleted dotnet sdk 3.0 version, but host version is still 3.0.3 does it affect running my program in 2.2 version of sdk?

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