Not able to create a NET Core 1.1 project when using the command DotNet New - asp.net-core

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?

Related

.NET Core 3.1 - dotnet ef add migration error

When I try to create a migration in my ASP.NET Core 3.1 MVC project, I get this error - I need help
Build started...
Build succeeded.
You must install or update .NET to run this application.
App: /Users/remzi/.dotnet/tools/.store/dotnet-ef/6.0.7/dotnet-ef/6.0.7/tools/net6.0/any/tools/netcoreapp2.0/any/ef.dll
Architecture: arm64
Framework: 'Microsoft.AspNetCore.App', version '3.1.0' (arm64)
.NET location: /usr/local/share/dotnet/
The following frameworks were found:
6.0.7 at [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Learn about framework resolution:
https://aka.ms/dotnet/app-launch-failed
To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=3.1.0&arch=arm64&rid=osx.12-arm64
Took me a lifetime to find the solution to this. 3.1 won't work because there is no arm64 version despite what it expects. To get around this you can force it to use this latest by typing the following into the terminal
export DOTNET_ROLL_FORWARD=LatestMajor

Asp .Net SDK 3.10408

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.

Version 5.0 is not allowed. Allowed version types are: majorVersion.x, majorVersion.minorVersion.x, majorVersion.minorVersion.patchVersion

Recently we migrated a .NET Core 3.1 project to .NET 5.0.
We have few pipelines setup using AzureDevOps
On Modifying the version of .NET Core SDK task from 3.1.x to 5.0; we faced the below exception
##[error]Version 5.0 is not allowed. Allowed version types are: majorVersion.x, majorVersion.minorVersion.x,
majorVersion.minorVersion.patchVersion. More details: The version
number: 5.0 doesn't have the correct format. Versions can be given in
the following formats: 2.x => Install latest in major version. 2.2.x
=> Install latest in major and minor version. 2.2.104 => Install exact version. Find the value of version for installing SDK/Runtime, from
the releases.json. The link to releases.json of that major.minor
version can be found in releases-index
file..
Like link to releases.json for 2.2 version is
https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/2.2/releases.json
Has AzureDevOps not been updated to .NET 5.0 or do we have to run test projects and pipelines only in .NET Core 3.1.x?
Also we are unable to locate any Agent job task available for .NET 5.0 in the Marketplace tab while creating the tasks.
You probably need to use UseDotNet task to get the .NET 5.0 downloaded and used in subsequent dotnet build task. See below example:
- task: UseDotNet#2
displayName: 'Install .Net 5 SDK'
inputs:
packageType: 'sdk'
version: '5.0.100'
- task: DotNetCoreCLI#2
inputs:
command: 'build'

dotnet command not working on centos server, runtime installed

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!!

need dotnet core 2.1 to show up in visual studio

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