4
votes

I am following this tutorial: Tutorial

I searched for about 4 hours and didn't find a solution for how to fix this error:

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.

I produced it with following command:

Scaffold-DbContext "Server=127.0.0.1;Database=vicotv;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models

Following I tried to update the EF SQL server.

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

But with this error the Package isn't updated.

The following is my project.json file:

{
"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":{

    }
}}

My dotnet information:

PM> dotnet --info

.NET Command Line Tools (1.0.0-preview2-1-003155)

Product Information:

Version: 1.0.0-preview2-1-003155

Commit SHA-1 hash: d7b0190bd4

Runtime Environment:

OS Name: Windows

OS Version: 10.0.14393

OS Platform: Windows

RID: win10-x64

What am I supposed to do?

1
What is your version of Visual Studio and what version of .net framework you use in your project ?Baro
@Baro I'm Using VisualStudio 2015 Professional and .net framwork wich i use in my project is: .NET Framework 4.5.2 and my Project is ASP.Net Core Web Applicationjoshii_h
I'm not really sure, because the tutorial link probably is out of date. One required is VS 2017, but probably because in that moment it supported .net Core and VS 2015 dosen't. But it seems to be strange that your project use a 4.5.2 version of framework, the Core version is the 6.x ! Could be your problem ?Baro
@Baro you mean i should try to install VS 2017 because it is a problem of VS 2015? This would cost a lot of time for the installing..joshii_h
Try using "Microsoft.EntityFrameworkCore.Tools":"1.1.0-preview4-final" in your project.json instead of msbuild3 because you are using project.json (and apparently not VS2017)Pawel

1 Answers

1
votes

I had a similar error trying to create a data migration for a code first project using Visual Studio 2015 .Netcore data project:

"Startup project 'Company.Application.Data' 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."

Solved using following steps using PowerShell:

  1. Navigate to the project directory(in my case f:_dev\Company.Application.Data)
  2. type: dotnet restore
  3. Add new migration example type: dotnet ef migrations add MyExampleMigrationName
  4. Your migration should appear in visual studio
  5. Edit your new migration as needed