I installed aspnet core runtime (aspnetcore-runtime-3.1.3) on a centOS 7 server.
following this guide from microsoft documentation: https://learn.microsoft.com/en-us/dotnet/core/install/runtime?pivots=os-linux#download-and-manually-install
my server doesn't have internet connection.
After installation, when I run any command, e.g.
dotnet --info
it says it can't find any installed dotnet sdk:
$ dotnet --info
It was not possible to find any installed .NET Core SDKs
Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from:
https://aka.ms/dotnet-download
Host (useful for support):
Version: 3.1.3
Commit: 4a9f85e9f8
.NET Core SDKs installed:
No SDKs were found.
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.3 [/home/myuser/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.3 [/home/myuser/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Previously, I downloaded the rpm package and installed it with rpm -ivh command, same result
What can I do to fix this?
Note that I don't have internet access in the server
EDIT: The problem: I don't need SDK to run this command or any command I am using.
Anyways I've tried installing SDK, it says it can't find any compatible frameworks
What is the problem? you just installed runtime, and the error says there is no sdk.
You installed the .net runtime but didn't install the any sdk. for you to be able use asp.net core you need to install both. you can visit asp.net core documentation for the difference between them. but you can just visit https://dotnet.microsoft.com/download to download the appropriate sdk you need.
nb: I assume you are doing this from a gui. i'm sure there are commands for installing the asp.net core runtime and SDK from command prompt. but what is important is that YOU ARE MISSING THE SDK!!
Related
I created a .net core 7 project using the entity framework core. Well, at that time I installed .net core 6 so my global ef tool was still version 6, then I updated to version 7. Here I had a problem, it said that I had not installed the framework. I decide to uninstall dotnet. Then I reinstalled sdk 7 and global ef tools. And new error appear. I try reinstall many times. But still like this, now I can't use the ef tool.
This is dotnet --info
.NET SDK:
Version: 7.0.101
Commit: bb24aafa11
Runtime Environment:
OS Name: ubuntu
OS Version: 22.04
OS Platform: Linux
RID: ubuntu.22.04-x64
Base Path: /usr/share/dotnet/sdk/7.0.101/
Host:
Version: 7.0.1
Architecture: x64
Commit: 97203d38ba
.NET SDKs installed:
7.0.101 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 7.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
DOTNET_ROOT [/usr/lib/dotnet]
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
And this is the error,
You must install .NET to run this application.
App: /home/apriza/.dotnet/tools/dotnet-ef
Architecture: x64
App host version: 7.0.1
.NET location: Not found
Learn about runtime installation:
https://aka.ms/dotnet/app-launch-failed
Download the .NET runtime:
https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=ubuntu.22.04-x64&apphost_version=7.0.1
I found my answer, I change the Root dotnet env which in /usr/share/dotnet for dotnet 7.
Run export DOTNET_ROOT=/usr/share/dotnet
I have a lot of legacy code that builds fine on Windows with .Net 4.5
I am trying to build the same on CentOS with dotnet-sdk for automation and licensing issues.
Following the Microsoft link after installing the required packages, this command fails
$ dotnet msbuild sharpTest.sln
/usr/share/dotnet/sdk/5.0.301/Microsoft.Common.CurrentVersion.targets(1216,5): error MSB3644: The reference
assemblies for .NETFramework,Version=v4.0 were not found. To resolve this, install the Developer Pack
(SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework
Developer Packs at https://aka.ms/msbuild/developerpacks
Since I installed dotnet-sdk-5, it seems the solution fails to build. But I could not locate .Net framework 4 for CentOS
How do I resolve this ?
It's referencing .NETFramework. .NETFramework V4.0 is not xplat and therefore not available on anything else than windows. You should try to re-target your solution to net5.0 and make it independent of Windows specific dependencies.
To re-target to net5.0 try the dotnet upgrade-assistant (it's a dotnet tool). Do this on a windows machine first. To address any windows dependencies that won't work outside windows or .NetFramework see the Overview of porting from .NET Framework to .NET
I run the code
dotnet new global.json --sdk-version 3.1.408
but I need to downgrade sdk-version 3.1.0
I deleted global.json folder again
project are developed in ASP .NetCore 3.1
then I try the dotnet new globaljson --sdk-version 3.1.0
If I run dotnet aspnet-codegenerator controller -name EmployeeController -m Employee -dc AppDbContext --relativeFolderPath Controllers --useDefaultLayout --referenceScriptLibraries
I got the following error:
A compatible installed .NET Core SDK for global.json version [3.1.0]
from [/home/dir_name/app1/global.json] was not found Install the
[3.1.0] .NET Core SDK or update [dir_name/app1/global.json] with an
installed .NET Core SDK:
3.1.408 [/snap/dotnet-sdk/123/sdk]
As the error message said, the 3.1.0 .NET Core SDK was not found, I assume you didn't install the 3.1.0 version .NET Core SDK.
Try to use the following command to check the installed SDK version:
dotnet --list-sdks
Then, you could download the 3.1.0 version .NET Core SDK and Runtime and install it.
When I try to upgrade ASP.NET Core in Nuget package manager, I get the following error:
Severity Code Description Project File Line Suppression State
Error Package Microsoft.AspNetCore.All 2.1.0-preview2-final is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package Microsoft.AspNetCore.All 2.1.0-preview2-final supports: netcoreapp2.1 (.NETCoreApp,Version=v2.1) 0
I have installed the sdk multiple times, so I'm confused because when I go to target it only has up to dotnet core 2.0 as an option. I installed visual studio preview but that hasn't helped either. Any suggestions?
For .NET Core 2.1 you need (currently) version 2.1.300-rc1 of the sdk. The version numbers of the SDK and .NET Core are not in sync, older 2.1 versions of the SDK are not enough.
This version can be downloaded from here: https://www.microsoft.com/net/download/dotnet-core/sdk-2.1.300-rc1
You can check the version on command line with donet --version command. dotnet --info will also list all the installed runtimes and SDKs.
> dotnet --version
2.1.300-rc1-008673
I have installed the dotnet-core for OS X using the dotnet-osx-x64.1.0.0.pkg from the official download section. - https://www.microsoft.com/net/download
Running "dotnet new" command gives the below output
Did you mean to run dotnet SDK commands? Please install dotnet SDK from:
http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
How to create the basic .net-core project?
I have run the below commands on the user directory without success
echo 'export PATH="$PATH:/usr/local/share/dotnet"' >> ~/.bashrc
and
Created a vi .bash_profile and inserted the below command
export
PATH=$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/share/dotnet
Still the below command fails
dotnet new
This is the version of the .net-core I have
dotnet --version
gives below output
Microsoft .NET Core Shared Framework Host
Version : 1.0.1
Build : cee57bf6c981237d80aa1631cfe83cb9ba329f12
dotnet-osx-x64.1.0.0.pkg is the package containing just .NET Core, basically the runtime.
In order to develop applications, you need the .NET Core SDK. This is also what the error message you see says:
Did you mean to run dotnet SDK commands? Please install dotnet SDK […]
The download website also explains the difference as follows:
You probably only need to download one of these:
.NET Core SDK = Develop apps with .NET Core and the SDK+CLI (Software Development Kit/Command Line Interface) tools
.NET Core = Run apps with the .NET Core runtime
So, just download the .NET Core SDK package for your platform instead. For mac OS, this currently is dotnet-dev-osx-x64.1.0.0-preview2-003121.pkg.
You can also just follow the instructions on the .NET Core quickstart page which gives you detailed step-by-step instructions on how to get .NET Core running properly.