New dotnet core project cannot restore
Asked Answered
N

2

7

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.
Nonrecognition answered 2/2, 2017 at 20:36 Comment(2)
.csproj has been supported only starting from .NET Core CLI Preview 3. Have you updated it on your machine?Balzer
I download the latest net core SDK yesterday from the websiteNonrecognition
V
8

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

Veroniqueverras answered 4/2, 2017 at 21:14 Comment(0)
S
2

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.

Saint answered 22/3, 2017 at 6:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.