2017-10-12 77 views
1

Fedorea 26上運行,我正在構建我的第一個dotnet core asp應用程序。在this教程之後,當我嘗試下面的命令dotnet restore時,我在下面得到一個錯誤 。簡單的喲項目上的dotnet恢復錯誤

我懷疑問題是yo構建一個dotnet core 1.x應用程序,但如下所示,我有dotnet core 2.0.0

這是正確的,如果是這樣,我該如何升級yo來構建dotnet 2.0項目?

yo aspnet 

_-----_  ╭──────────────────────────╮ 
|  | │  Welcome to the  │ 
|--(o)--| │ marvellous ASP.NET Core │ 

---------´ │ generator! │ (_´U _)╰──────────────────────────╯ / \/ | 〜|
」 ._ .'__
'|° ´ Y

? What type of application do you want to create? Empty Web Application 
? What's the name of your ASP.NET application? WeatherMicroservice 
    create WeatherMicroservice/.gitignore 
    create WeatherMicroservice/Program.cs 
    create WeatherMicroservice/Startup.cs 
    create WeatherMicroservice/WeatherMicroservice.csproj 
    create WeatherMicroservice/web.config 
    create WeatherMicroservice/Properties/launchSettings.json 
    create WeatherMicroservice/runtimeconfig.template.json 
    create WeatherMicroservice/README.md 
    create WeatherMicroservice/global.json 


Your project is now created, you can use the following commands to get going 
    cd "WeatherMicroservice" 
    dotnet restore 
    dotnet build (optional, build will also happen when it's run) 
    dotnet run 


[[email protected] asp-core]$ cd WeatherMicroservice/ 
[[email protected] WeatherMicroservice]$ dotnet restore 

The specified SDK version [1.0.0-rc4-004771] from global.json [/home/idf/Documents/asp-core/WeatherMicroservice/global.json] not found; install specified SDK version 
Did you mean to run dotnet SDK commands? Please install dotnet SDK from: 
    http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409 

這是安裝的dotnet版本:

[[email protected] WeatherMicroservice]$ dotnet --info output: 
The specified SDK version [1.0.0-rc4-004771] from global.json [/home/idf/Documents/asp-core/WeatherMicroservice/global.json] not found; install specified SDK version 

Microsoft .NET Core Shared Framework Host 

    Version : 2.0.0 
    Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d 

[[email protected] WeatherMicroservice]$ 

回答

3

呦仍在ASP.NET Core 1.0 RC4。還有一個請求ticket升級到.NET Core 2.0。

也許你最好的選擇是使用dotnet new。 您可以輸入dotnet new -l以列出所有可用的模板。對於空網站應用程序項目dotnet new web。 您可以查看this鏈接瞭解dotnet new的更多信息。

0

打開文件global.json 請看到用什麼:

{ 
"sdk": { 
"version": "xxx.yyy.zzz" 
} 
} 

現在,打開控制檯,並寫下:

dotnet --version 

你需要在你的JSON文件寫這個版本