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.
Related
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!!
One knows how to check if the .net core SDK is installed or not (you need dotnet --version or where dotnet). How about .net core runtime as well as the aspnet core runtime?
PS: since in production we don't need the .net Core SDK
dotnet --info will show the version of the SDK (if installed), the names and versions of all the runtimes that are installed, including the .NET Core runtime and ASP.NET Core runtime.
$ dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 2.1.301
Commit: 59524873d6
Runtime Environment:
OS Name: fedora
OS Version: 28
OS Platform: Linux
RID: fedora.28-x64
Base Path: /usr/lib64/dotnet/sdk/2.1.301/
Host (useful for support):
Version: 2.1.1
Commit: N/A
.NET Core SDKs installed:
2.1.202 [/usr/lib64/dotnet/sdk]
2.1.301 [/usr/lib64/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.NETCore.App 2.0.9 [/usr/lib64/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.1 [/usr/lib64/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
If you only care about the runtime (.NET Core and ASP.NET Core) versions, you can use dotnet --list-runtimes. This requires a recent-enough version of .NET Core:
$ dotnet --list-runtimes
Microsoft.NETCore.App 2.0.9 [/usr/lib64/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.1 [/usr/lib64/dotnet/shared/Microsoft.NETCore.App]
I don't have the ASP.NET Core runtime packages installed, so it only shows me the .NET Core runtime.
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 tried to create a new ASP.NET Core 1.1 project using:
dotnet new
However I got the following error:
The specified framework 'Microsoft.NETCore.App', version '1.0.1' was not found.
Check application dependencies and target a framework version installed at:
The following versions are installed: 1.1.0
Alternatively, install the framework version '1.0.1'.
But I do want to create a 1.1 project. I have the following installed:
What am I missing?
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.