Dotnet Restore Command Not Found – Exploring The New DotNet CLI

Aspnetcore 1

It has been a year since I posted Taking Visual Studio Code and ASP.Net 5 For A Spin on which I tried to create a simple ASP.Net 5 web application using the then just released free Visual Studio Code. Microsoft also released in Beta that time the new .net framework based which called DNX which is now known as .Net Core. In this post, I will try again to create simple web application using the new .Net Core.

Trying from Yo

I will use Yeoman to help me with the scaffolding of a new web application.

 yo aspnet 

Yeoman

After yeoman generated a web application for me, a confirmation message is displayed that the new project is now created and I can do now a “dotnet restore”.

Dotnetrestore yeoman

Going to the new web application directory I issued a command “dotnet restore” but I got a command not found error. I updated my Visual Studio Code just hoping to get an updated version of the framework along with it but to no avail.

Hello “Dotnet” .Net Core 1.0

Microsoft released last June of .Net Core 1.0 and along with it the new Dotnet CLI.

The DotNet CLI is included if you install the .Net Core SDK Installer. There is also a separate installer for .Net Core only.

You can get the installers straight from Github https://github.com/dotnet/cli/ (for the latest builds) or from https://www.microsoft.com/net/core

See all the flavours from the table below I got from the .Net Core Github repo:

Cli flavours

Sidenote:
Some hiccups along the way of updating my openSSL and brew. Need to execute “xcode-select —install” command to update. This is somewhat related to the El Capitan macOS that I have on my mac.

Sidenote

After installing the .Net Core with SDK, “dotnet” command is now available. As of today here’s my “dotnet —info”

Noels-MacBook-Pro:~ noelarlante$ dotnet --info
.NET Command Line Tools (1.0.0-preview2-003121)

Product Information:
 Version:            1.0.0-preview2-003121
 Commit SHA-1 hash:  1e9d529bc5

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.11
 OS Platform: Darwin
 RID:         osx.10.11-x64

Sidenote: “dotnet restore” still does not work. I’m getting an error related to this question posted on Stackoverflow . I’ll post an update once this has been resolved.

Sidenote2

Until next time!

Permission Denied Error On Npm Install For Yeoman

Yeoman 007

I was trying to create a simple ASP.Net 5 project by using generator like Yeoman on my Mac. The instructions on ASP.Net docs website are simple and easy to follow. However I encountered a permission denied error on npm install for Yeoman.

Npm Error Permission Denied

Initially I thought I was not running an updated npm version so I tried to execute npm upgrade, but it did not work. I also tried to install again npm getting the installing from nodejs.org but the same error occurs.

Looking closely at the log, it was a permission error on a mkdir on /usr/local/bin folder. This was verified when I go to that folder and tried to create a folder but a permission error occurs. Getting closer to the root of the problem!

Wheels

When I looked into the owner and group permissions in the folder, the group owner for node_modules (where the install is targeting the mkdir) is a group name wheel. The group name wheel seems to have been related to the roots of MAC OS X from Unix.

Wheels MacOS Permission

I issued two commands to gain permission to the folder.

sudo chgrp -R admin node_modules

sudo chown -R whoami nodel_modules

After gaining permission to the folder, I once again tried to install Yeoman using npm and the installation went through this time.

Npm yo Ok now

I hope this will save you time if ever you encounter the same problem on your way to trying more ASP.Net 5 samples.