Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

New dotnet core project cannot restore

I attempted to create a new project using the yeoman generator, however when i then move into the folder to restore the dependencies I encounter an error.

I start in an empty directory then execute the following

yo aspnetcore-spa (select the Aurelia framework and .csproj project type)
dotnet restore

I get the following error

warn : The folder '<path>/projFolder' does not contain a project to restore.
like image 737
SJC Avatar asked Feb 02 '17 20:02

SJC


2 Answers

.NET Core projects using csproj require at least .NET Core CLI Preview 3. Double check which version is being used by running dotnet --info. If it is 1.0.0-preview2 or 1.0.0-preview2-1, it does not support csproj.

At the time of writing, the SDKs that support csproj are not listed on the main .NET Core download page. The latest is the RC3 release of .NET Core CLI.

https://github.com/dotnet/core/blob/master/release-notes/rc3-download.md

If you have installed the new SDK and dotnet --info still shows an older version, check for a global.json file in the current directory or any parent directories and make sure the "sdk" setting has the right version. The aspnetcore-spa generated creates a global.json file with SDK 1.0.0-preview3-004056, which is not the latest SDK.

like image 75
natemcmaster Avatar answered Sep 22 '22 17:09

natemcmaster


Just update your dotnet-core-framework-version.
I fixed this by doing:

apt-get remove dotnet-dev-1.0.0-preview2-1-003177 
apt-get install dotnet-dev-1.0.0-rc4-004771 

Then:

dotnet restore

worked.

Then, you must reinstall the framework 1.1.1:

apt-get install dotnet-sharedframework-microsoft.netcore.app-1.1.1

(currently [22.03.2017], Visual Studio 2017 will use .NET Core 1.1.1 when it does publish)

Also, when you run a published project, it's

dotnet yourdll.dll 

and not

dotnet run yourdll.dll 


Edit:
Just one day later, and you might want to

apt-get install dotnet-dev-1.0.1

instead of rc4. You can then skip sharedframework, as sharedframework 1.1.1 gets installed automatically with dotnet-dev-1.0.1.

like image 38
Stefan Steiger Avatar answered Sep 22 '22 17:09

Stefan Steiger