首先,我下面這個教程:Tutorial.NET核心的NuGet EF Core版本doesan't比賽
我搜索sience約4小時,並沒有找到一個解決方案如何解決這個錯誤:
Startup project 'DatabaseConnection' is an ASP.NET Core or .NET Core project for Visual Studio 2015. This version of the Entity Framework Core Package Manager Console Tools doesn't support these types of projects.
我用下面的命令生成它:
Scaffold-DbContext "Server=127.0.0.1;Database=vicotv;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
接着我嘗試更新EF SQL服務器。
PM> Install-Package Microsoft.EntityFrameworkCore.Tools -Version 1.1.0-msbuild3-final
GET https ://api.nuget.org/v3/registration1-gz/microsoft.entityframeworkcore.tools/index.json GET https ://www.nuget.org/api/v2/curated-feeds/microsoftdotnet/Packages(Id='Microsoft.EntityFrameworkCore.Tools',Version='1.1.0-msbuild3-final') OK https ://api.nuget.org/v3/registration1-gz/microsoft.entityframeworkcore.tools/index.json 143ms Error finding repository for 'https ://www.nuget.org/api/v2/curated-feeds/microsoftdotnet/': An error occurred while retrieving package metadata for 'Microsoft.EntityFrameworkCore.Tools.1.1.0-msbuild3-final' from source 'Microsoft and .NET'. A task was canceled. Retrieving package 'Microsoft.EntityFrameworkCore.Tools 1.1.0-msbuild3-final' from 'nuget.org'. Installing NuGet package Microsoft.EntityFrameworkCore.Tools.1.1.0-msbuild3-final. Successfully installed 'Microsoft.EntityFrameworkCore.Tools 1.1.0-msbuild3-final' to DatabaseConnection Executing nuget actions took 122.12 ms Time Elapsed: 00:00:00.9439736
但有了這個錯誤包沒有更新。 繼我project.json文件:
{
"buildOptions":{
"emitEntryPoint":true,
"preserveCompilationContext":true
},
"dependencies":{
"Microsoft.EntityFrameworkCore.SqlServer":"1.1.0",
"Microsoft.EntityFrameworkCore.SqlServer.Design":"1.1.0",
"Microsoft.ApplicationInsights.AspNetCore":"2.0.0",
"Microsoft.AspNetCore.Mvc":"1.1.1",
"Microsoft.AspNetCore.Routing":"1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration":"1.1.0",
"Microsoft.AspNetCore.Server.Kestrel":"1.1.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables":"1.1.0",
"Microsoft.Extensions.Configuration.FileExtensions":"1.1.0",
"Microsoft.Extensions.Configuration.Json":"1.1.0",
"Microsoft.Extensions.Logging":"1.1.0",
"Microsoft.Extensions.Logging.Console":"1.1.0",
"Microsoft.Extensions.Logging.Debug":"1.1.0",
"Microsoft.Extensions.Options.ConfigurationExtensions":"1.1.0",
"Microsoft.NETCore.App":"1.1.0",
"Microsoft.EntityFrameworkCore.Design":"1.1.0",
"Microsoft.EntityFrameworkCore":"1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration.Tools":"1.1.0-preview4-final",
"Microsoft.EntityFrameworkCore.Tools":"1.1.0-msbuild3-final"
},
"frameworks":{
"netcoreapp1.0":{
"imports":[
"dotnet5.6",
"portable-net45+win8"
]
}
},
"publishOptions":{
"include":[
"wwwroot",
"**/*.cshtml",
"appsettings.json",
"web.config"
]
},
"runtimeOptions":{
"configProperties":{
"System.GC.Server":true
}
},
"scripts":{
"postpublish":[
"dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
]
},
"tools":{
},
"runtimes":{
"win10-x86":{
},
"win10-x64":{
}
}}
我DOTNET信息:
PM> DOTNET --info
.NET命令行工具(1.0.0-preview2-1-003155)
產品信息:
版本:1.0.0-preview2-1-003155
提交SHA-1散列:d7b0190bd4
運行環境:
操作系統名稱:Windows
OS版本:10.0.14393
OS平臺:視窗
RID:win10- 64
注:我添加空格的鏈接,因爲我沒有帶足夠的聲譽。
我打算做什麼?
什麼是您的Visual Studio版本以及您在項目中使用的.net框架的哪個版本? – Baro
@Baro我使用VisualStudio 2015專業版和.NET框架,我在我的項目中使用的是:.NET Framework 4.5.2和我的項目是ASP.Net核心Web應用程序 –
我不太確定,因爲教程鏈接可能已經過時了。一個需要的是VS 2017,但可能是因爲那時它支持.net Core和VS 2015。但是你的項目使用4.5.2版本的框架似乎很奇怪,Core版本是6.x!可能是你的問題? – Baro