2016-11-19 2 views
6

스캐 폴딩에 문제가 있습니다 DbContext. 최신 .NET Core 1.1.0 SDK을 사용 중이며이 안내서를 따르고 있습니다. https://docs.microsoft.com/en-us/ef/core/get-started/aspnetcore/existing-dbEF 코어 스캐 폴드 DbContext

그러나 패키지 관리자 콘솔에서 다음 명령을 실행할 때 : Scaffold-DbContext "<connection-string>" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models 예외가 발생합니다.

project.json

"dependencies": { 
    "Microsoft.EntityFrameworkCore": "1.1.0", 
    "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", 
    "NETStandard.Library": "1.6.1" 
    }, 

    "tools": { 
    "Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final" 
    }, 

    "frameworks": { 
    "netstandard1.6": { 
     "imports": [ 
     "dnxcore50" 
     ] 
    } 
    } 

예외

System.IO.FileNotFoundException: Could not load file or assembly 
'System.Data.SqlClient, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. 
File name: 'System.Data.SqlClient, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 
    at Microsoft.EntityFrameworkCore.Scaffolding.Internal.SqlServerDatabaseModelFactory.Create(String connectionString, TableSelectionSet tableSelectionSet) 
    at Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory.Create(String connectionString, TableSelectionSet tableSelectionSet) 
    at Microsoft.EntityFrameworkCore.Scaffolding.Internal.SqlServerScaffoldingModelFactory.Create(String connectionString, TableSelectionSet tableSelectionSet) 
    at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ReverseEngineeringGenerator.GetMetadataModel(ReverseEngineeringConfiguration configuration) 
    at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ReverseEngineeringGenerator.GenerateAsync(ReverseEngineeringConfiguration configuration, CancellationToken cancellationToken) 
    at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContextAsync(String provider, String connectionString, String outputDir, String dbContextClassName, IEnumerable`1 schemas, IEnumerable`1 tables, Boolean useDataAnnotations, Boolean overwriteFiles, CancellationToken cancellationToken) 
    at Microsoft.EntityFrameworkCore.Design.OperationExecutor.<ScaffoldContextImpl>d__22.MoveNext() 
    at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source, Int32& length) 
    at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source) 
    at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) 
    at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass4_0`1.<Execute>b__0() 
    at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action) 
Could not load file or assembly 'System.Data.SqlClient, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. 
+0

이 문제점에 대한 업데이트는 있습니까? –

+1

예 : https://github.com/aspnet/EntityFramework/issues/7068 –

답변

1

이에 대한 현재의 해결 방법은 솔루션의 시작 프로젝트로 구성되어 실행 프로젝트의 발판을 실행하는 것입니다 .

관련 문제