efcore icon indicating copy to clipboard operation
efcore copied to clipboard

Strange ef dbcontext scaffold experience

Open WillBaldwin opened this issue 10 years ago • 2 comments

Steps to reproduce

  1. Start with a new ASP.NET Core Web Application (.NET Core)
  2. Select Asp.NET Core Templates: Web Application
    1. Install-Package Microsoft.EntityFrameworkCore.Tools -Pre
    2. Install-Package Microsoft.EntityFrameworkCore.SqlServer -Pre
    3. Install-Package Microsoft.EntityFrameworkCore.SqlServer.Design -Pre
    4. Add to Project.json
            "Microsoft.EntityFrameworkCore.Tools": {
        "version": "1.0.0-preview1-final",
        "imports": [
            "portable-net45+win8+dnxcore50",
            "portable-net45+win8"
        ]
    },
5. cd src
6. cd MyProject
7. dotnet ef dbcontext scaffold -c ApplicationContext -o Models "Data Source=MyServer;Initial Catalog=MyDatabase;Integrated Security=True" Microsoft.EntityFrameworkCore.SqlServer --force

The issue

The database schema is reverse engineered as expected. An unexpected error message is returned with no apparent remedy

dotnet : Done
At line:1 char:1
+ dotnet ef dbcontext scaffold -c ApplicationContext -o Models "Data So ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Done:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

Further technical details

EF Core version: 1.0.0-rc2-final Operating system: Windows 10 Enterprise Visual Studio version: VS 2015

WillBaldwin avatar Jun 13 '16 16:06 WillBaldwin

@WillBaldwin My suspicion is you'll need to either put single quotes as well as double quotes around the connection string and/or install Powershell 5. Please see #5376 for details.

lajones avatar Jun 13 '16 17:06 lajones

Actually, the error here is a little misleading, but will be fixed in preview2.

What is happening: Preview 1 logs the message "Done" to the stderr. PowerShell treats any output to stderr as an "error" and shows the warning, but the "dotnet ef" command actually ran just fine. We fixed this for Preview 2 by logging "Done" to stdout instead. This fix was added in https://github.com/aspnet/EntityFramework/pull/5542.

Closing as a duplicate of https://github.com/aspnet/EntityFramework/issues/5012

natemcmaster avatar Jun 13 '16 17:06 natemcmaster