2017-02-28 87 views
2

我正在嘗試使用.Net核心類庫項目中的EF Core對現有數據庫進行逆向工程。.Net Core v。1.1.0找不到

這裏的project.json

{ 
    "dependencies": { 
    "Microsoft.NETCore.App": { 
     "version": "1.1.0", 
     "type": "platform" 
    }, 
    "Microsoft.EntityFrameworkCore.Design": "1.1.0", 
    "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0", 
    "Microsoft.EntityFrameworkCore.SqlServer.Design": "1.1.0", 
    "Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final" 
    }, 

    "frameworks": { 
    "netcoreapp1.1": { 
     "imports": [ 
     "dotnet5.6", 
     "portable-net45+win8" 
     ] 
    } 
    } 
} 

,這是我得到的錯誤:

PM> scaffold-dbcontext "data source=Server;Initial Catalog=Database;Integrated Security=true" Microsoft.EntityFrameworkCore.SqlServer -verbose 
Build started... 
Build succeeded. 
The specified framework 'Microsoft.NETCore.App', version '1.1.0' was not found. 
    - Check application dependencies and target a framework version installed at: 
     C:\Program Files\dotnet\shared\Microsoft.NETCore.App 
    - The following versions are installed: 
     1.0.1 
     1.1.0-preview1-001100-00 
    - Alternatively, install the framework version '1.1.0'. 
Process finished with non-zero exit code 

這是當我有針對性的.Net的1.1.0。

enter image description here

回答

7

由於錯誤日誌中說,你沒有你的機器上安裝了1.1.0版本的.NET核心。 scaffold-dbcontext工具需要此版本,它是.NET Core CLI的一部分,不屬於您的應用程序,因此不會使用您的應用程序中的nuget軟件包。

要安裝.NET Core 1.1.0,請轉到.NET Core Download頁面並選擇您需要的x86/x64版本。之後,您將在C:\Program Files\dotnet\shared\Microsoft.NETCore.App中擁有新的'1.1.0'文件夾,這是.NET Core框架的默認位置。

+0

你檢查了我包括的圖像嗎? – Arrrr

+0

@Arrrr是的,正如我所說 - nuget包不是什麼需要的。您應該安裝框架(檢查您的'C:\ Program Files \ dotnet \ shared \ Microsoft.NETCore.App'文件夾)。 – Set

+0

請對您的帖子進行修改,以便我可以收回我的投票。 – Arrrr