首先,我下面这个教程: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