"dotnet new" command fails on fresh installation of OS X 10.11.6 OS X El Capitan - asp.net-core

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.

Related

How to build application targetting .Net 4/4.5 on CentOs

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

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

.NET Blazor Build error

I have tried to run the out of the box Blazor application to try out C# WebAssembly. I am running into issues when trying to run it different ways. I have also tried to hack the runtimeconfig.json according to this https://github.com/dotnet/cli/issues/7543
Running IIS Express
Running BlazorApplication1
The program '[42032] dotnet.exe' has exited with code -2147450749 (0x80008083).
Running in command line
It was not possible to find any compatible framework version
The specified framework 'Microsoft.NETCore.App', version '2.0.0-preview3-25512-01' was not found.
- Check application dependencies and target a framework version installed at:
\
- Alternatively, install the framework version '2.0.0-preview3-25512-01'.
You need to have the 2.1 preview of the .net core framework installed for Blazor to work: download here

dotnet core version number and corresponding build

On dev server when i check dotnet core version number it shows
C:\>dotnet --version
Microsoft .NET Core Shared Framework Host
Version : 1.1.0
Build : 928f77c4bc3f49d892459992fb6e1d5542cb5e86
How do i find corresponding build/installation files on dotnet core download page
I am setting up a new server and i need to make sure i have the same version of dotnet core runtime installed as dev.
Also on the same note where can i find prevision vresions on Windows Server Hosting for dotnet core
Screenshot
Just search for the tags or releases inside the .Net Core Github repo or on the archives site on Microsoft.
But you should really upgrade to a version that is not end of life.

"netcoreapp1.0" is an unsupported framework. - Asp.Net Core Music Store

I'm just trying out asp.net core for the first time. Opening up the newly updated music store app but I can't get it to build Nuget tells me:
Errors in C:\development\MusicStore\test\E2ETests\project.json
"netcoreapp1.0" is an unsupported framework.
How can I get the .net framework reference to restore?
RC2 was released yesterday, and now you can. You need:
Install tooling for VS2015 from https://go.microsoft.com/fwlink/?LinkId=798481 (link from step 1)
Upgrade NuGet (VS Extensions) - 3.4.3.855 (auto-updated) works for me, but version 3.5.0 (beta) is recommended here (second link in step 1).
Edit your global.json file - update version property to 1.0.0-preview1-002702 (details here)
In ASP.NET Core 1.0 RTM Tools Preview 2 the version needs to be:
"version": "1.0.0-preview2-003121"
(Run dotnet --version to make sure) Then don't forget to run:
dotnet restore
in your Package Manager Console, Command Prompt or Git Bash