Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EF Tools 1.1.0-preview4 Unrecognized option '--config' #7071

Closed
michaelroef opened this issue Nov 20, 2016 · 33 comments
Closed

EF Tools 1.1.0-preview4 Unrecognized option '--config' #7071

michaelroef opened this issue Nov 20, 2016 · 33 comments
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug

Comments

@michaelroef
Copy link

michaelroef commented Nov 20, 2016

Notes by @rowanmiller

This affects just the 1.1.0-preview4 tools on apps that target full .NET (rather than .NET Core). I have not been able to find a way to workaround this with the latest tools preview.

The best option right now is to roll back to the 1.0.0-preview3 version of the Microsoft.EntityFrameworkCore.Tools.DotNet package. Fortunately, because of the way things are factored, you can keep using the 1.1 versions of all the other packages.

  "tools": {
    "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.0.0-preview3-final"
  },

Steps to reproduce

  1. Upgrade nuget packages from v1.0.1 to v1.1.0.
  2. Use 'dotnet ef' to generate migrations
  3. Error: Unrecognized option '--config'

I've tried to delete the older SDK and runtime, but it doesn't solve the problem.

The issue

It's not possible to generate migrations with v1.1.0.
The website is building and running successfully.

Further technical details

EF Core version: 1.1.0
Operating system: Windows 10
Visual Studio version: VS2015

My project.json:

{
  "dependencies": {
    "TinyMapper": "2.0.8",
    "Hangfire.Dashboard.Authorization": "2.1.0",
    "Hangfire": "1.6.6",
    "Hangfire.SqlServer": "1.6.6",
    "Microsoft.AspNetCore.Authentication.JwtBearer": "1.1.0",
    "Microsoft.AspNetCore.Diagnostics": "1.1.0",
    "Microsoft.AspNetCore.Mvc": "1.1.0",
    "Microsoft.AspNetCore.Owin": "1.1.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
    "Microsoft.AspNetCore.StaticFiles": "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.DependencyInjection": "1.1.0",
    "Microsoft.Extensions.DependencyInjection.Abstractions": "1.1.0",
    "Microsoft.Extensions.Logging": "1.1.0",
    "Microsoft.Extensions.Logging.Console": "1.1.0",
    "Microsoft.Extensions.Logging.Debug": "1.1.0",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
    "Microsoft.EntityFrameworkCore.SqlServer.Design": "1.1.0",
    "Microsoft.EntityFrameworkCore.Tools": {
      "version": "1.1.0-preview4-final",
      "type": "build"
    }
  },

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

  "frameworks": {
    "net461": {}
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "Views",
      "Areas/**/Views",
      "appsettings.json",
      "web.config"
    ]
  },

  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}
@VahidN
Copy link

VahidN commented Nov 20, 2016

If you want to use package manager console to run the migrations, Microsoft.EntityFrameworkCore.Tools is necessary, because this package only contains .ps1 files, located at:

%UserProfile%\.nuget\packages\Microsoft.EntityFrameworkCore.Tools\1.1.0-preview4-final\tools

Also ensure Microsoft.EntityFrameworkCore.Tools is referenced in the dependencies section of your project.json file. NuGet won't load the Package Manager Commands from the tools section.

If you want to use dotnet ef commands, you will need these packages too:

PM> Install-Package Microsoft.EntityFrameworkCore.Tools.DotNet –Pre
PM> Install-Package Microsoft.EntityFrameworkCore.Design
    "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": {
            "version": "1.1.0-preview4-final",
            "imports": [
                "portable-net45+win8"
            ],
            "type": "build"
        }
    },

    "tools": {
        "Microsoft.EntityFrameworkCore.Tools.DotNet": {
            "version": "1.1.0-preview4-final",
            "imports": [
                "portable-net45+win8"
            ]
        },
        "Microsoft.EntityFrameworkCore.Tools": {
            "version": "1.1.0-preview4-final",
            "imports": [
                "portable-net45+win8"
            ]
        }
    },

@KolyaNET
Copy link

More on the topic #7076

I have a similar problem Unrecognized option '--config'

@rowanmiller
Copy link
Contributor

Confirmed what we speculated in triage: this affects just the 1.1.0-preview4 tools on apps that target full .NET (rather than .NET Core). I couldn't find a way to workaround this with the latest tools preview.

The best option right now is to roll back to the 1.0.0-preview3 version of the Microsoft.EntityFrameworkCore.Tools.DotNet package. Fortunately, because of the way things are factored, you can keep using the 1.1 versions of all the other packages.

  "tools": {
    "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.0.0-preview3-final"
  },

@rowanmiller rowanmiller removed this from the 1.2.0 milestone Nov 21, 2016
@rowanmiller rowanmiller removed their assignment Nov 21, 2016
@rowanmiller
Copy link
Contributor

Clearing to re-discuss in triage. To me, this would probably be patch worthy, but I'm not sure that we are planning to patch the preview tooling.

@rowanmiller rowanmiller changed the title Generate migrations not working after v1.1.0 upgrade EF Tools 1.1.0-preview4 Unrecognized option '--config' Nov 22, 2016
@rowanmiller rowanmiller added this to the 1.2.0 milestone Nov 22, 2016
@bricelam
Copy link
Contributor

bricelam commented Nov 22, 2016

This is fixed in dev (could become 1.1.0-preview5) and dev2 (will become 1.0.0-msbuild2).

@rowanmiller
Copy link
Contributor

@bricelam does just using preview3 for full .NET projects seem like the best workaround to you?

@bricelam
Copy link
Contributor

Yes, but it depends on Microsoft.NETCore.App 1.0 which is the problem we were trying to solve with the 1.1.0-preview4 release.

@bricelam
Copy link
Contributor

Using the nightly builds would solve both problems 😉

@smitpatel
Copy link
Contributor

@bricelam - If CI passes. 😜

@memark
Copy link

memark commented Nov 28, 2016

I have the same problem, and would love to try out the nightly build. Is it available on a feed?

Any idea when 1.1.0-preview5 might come out?

@michaelroef
Copy link
Author

michaelroef commented Nov 28, 2016

Just edit project.json and change the tools back to 1.0.0-preview3.
It works with the latest EntityFrameworkCore (v1.1.0).

@bricelam
Copy link
Contributor

bricelam commented Nov 28, 2016

The nightly feed is available here.

@bricelam bricelam added tools closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. labels Nov 28, 2016
@memark
Copy link

memark commented Nov 28, 2016

@microef Thanks, I does work. But it also requires me (and all my devs) to install platform 1.0.0 (we're on 1.1.0), which I'd rather avoid.
@bricelam Thanks, I'll try it out!

@memark
Copy link

memark commented Nov 28, 2016

@bricelam Working excellently in 1.2.0-preview4-22817. Thanks!

@SocVi100
Copy link

SocVi100 commented Dec 9, 2016

Any new on this? In my case the proposed workarounds don't work, neither using the nightly builds nor downgrading the tools to 1.0.0-preview3. I'm really desesperated. I've lost two days with this and I always hit an end with an error, like this (unrecognized option --config) or this:

Could not load assembly 'Sales'. Ensure it is referenced by the startup project 'Sales'

That is absurd, as my app has only one project and is not a dll (it has also emitEntryPoint:true set).
This is my favourite one:

error: Package Microsoft.EntityFrameworkCore.Tools.DotNet 1.0.0-preview3-final is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.EntityFrameworkCore.Tools.DotNet 1.0.0-preview3-final supports: netcoreapp1.0 (.NETCoreApp,Version=v1.0)

I've read it five times to get sure that in the second sentence is telling just the opposite of the first one.

Furthermore, commands are not working on the PMC anymore, no matter wich version of the tools I install, no matter if I restore the packages and if I restart the computer...

Is this a joke? I'm getting crazy with so many versions of everything and I only want to create a migration, it doesn't matter wich version of the tools I have to use... Is there a valid option nowadays? Is very far the next release of the tools? This seems a rabbit hole I can't scape... Please tell me what is the maximum version I can target to get this work.

@bricelam
Copy link
Contributor

@SocVi100, it looks like you got to the bottom it. Well done! x86 will be supported in the new MSBuild-based tooling (for best results, wait for version 1.0.0-msbuild3-final or use the feature work nightly feed).

@SocVi100
Copy link

@bricelam, thanks! It has been a hard way though...

I don't know yet where the "platform": "x86" setting came from. I didn't want to target any platform specifically but in some moment it "slipped in".

Anyway, I pity you all in the team, there has been too many changes on key aspects since the "vnext" started its road and that burns anybody a lot. I supose it may be hard to work with so many changing premises.

@AR1ES
Copy link

AR1ES commented Dec 14, 2016

@bricelam
Package Microsoft.EntityFrameworkCore.Tools.DotNet 1.2.0-preview4-22878 is not compatible with net461

@smitpatel
Copy link
Contributor

@AR1ES - Are you using project.json based project? If yes then you need to put Tools.DotNet package under "tools" node instead of "dependencies".

@AR1ES
Copy link

AR1ES commented Dec 15, 2016

@smitpatel , thanks. Tools.DotNet was under tools section and under dependencies.

@chassq
Copy link

chassq commented Dec 18, 2016

Hey,

After reading all this above I can still not figure out the problem or solution. We have this project.json file content:

{
"dependencies": {
"Microsoft.AspNetCore.Hosting": "1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",

"Microsoft.EntityFrameworkCore": "1.1.0",
"Microsoft.EntityFrameworkCore.Design": "1.1.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
"Microsoft.EntityFrameworkCore.SqlServer.Design": "1.1.0"

},
"tools": {
"Microsoft.EntityFrameworkCore.Tools.DotNet": "1.1.0-preview4-final"
},
"buildOptions": {
"emitEntryPoint": true
},
"frameworks": {
"net462": {}
},
"configurations": {
"TestDebug": {},
"TestRelease": {}
}
}

We get the error "Unrecognized option '--config' when we run the following CLI cmd from the cmd line console:

dotnet ef dbcontext scaffold "Server=;Initial Catalog=;Persist Security Info=False;User ID=;Password=;Pooling=False;Encrypt=True;TrustServerCertificate=False;" Microsoft.EntityFrameworkCore.SqlServer --output-dir models --force

We are on Windows 10 (latest patches). VS 2015 (latest patches). We also have installed on the dev machine VS 2017 to play with it (Not clear if that somehow messed us up).

We tried rolling back to "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.0.0-preview3-final" but get a message we do not have the 1.0.0 framework installed.

We looked for Microsoft.EntityFrameworkCore.Tools.DotNet 1.2.0-preview4-22878 but cannot find it in the nuget pkg list. Is it a daily build?

Any definitive ideas or help will be greatly appreciated.

P.S. Sorry to say, because we love .NET Core so far but this just feels like a mess that we cannot seem to get clarification on. We just cannot be expected to work our way through all these various versions, etc when we are supposedly doing an upgrade to a stable release. I know you guys are working hard and it is appreciated but sometimes it feels like we are back in dll hell from years ago, except now its packages, sdks and platforms with all different versions and endless possible combinations. Sorry just needed to get that out. I know it will get better.

@AR1ES
Copy link

AR1ES commented Dec 18, 2016

@chassq, my working solution was to use 1.1.0-preview3-final.
I had a lot of different errors. Initially 1.1.0-preview3-finals did not work.
Try the following steps:

  1. Set "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.0.0-preview3-final" under tools section in the project.json.
  2. Execute dotnet restore
    3!!!. Delete bin/obj from project directory
  3. Execute dotnet build
  4. Execute ef command dotnet ef dbcontext scaffold .......

@chassq
Copy link

chassq commented Dec 18, 2016

Thanks for the quick reply. Here is what we get now:
project.json
{
"dependencies": {
"Microsoft.AspNetCore.Hosting": "1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.EntityFrameworkCore": "1.1.0",
"Microsoft.EntityFrameworkCore.Design": "1.1.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
"Microsoft.EntityFrameworkCore.SqlServer.Design": "1.1.0"
},
"tools": {
"Microsoft.EntityFrameworkCore.Tools.DotNet": "1.0.0-preview3-final"
},
"buildOptions": {
"emitEntryPoint": true
},
"frameworks": {
"net462": {}
},
"configurations": {
"TestDebug": {},
"TestRelease": {}
}
}

Restored, cleaned and deleted bin/obj per above.

Ran the CLI cmd and get this:
The specified framework 'Microsoft.NETCore.App', version '1.0.0' was not found.

  • Check application dependencies and target a framework version installed at:
    C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App
  • The following versions are installed:
    1.1.0
  • Alternatively, install the framework version '1.0.0'.

How should we go about installing the 1.0.0 version as specified in the message?

Thanks!

@bricelam
Copy link
Contributor

@chassq Install the LTS Runtime from the .NET Core Downloads page.

@chassq
Copy link

chassq commented Dec 20, 2016

Thank you very much. That did the trick. Working again.

@cda-1
Copy link

cda-1 commented Jan 3, 2017

I got this error with "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.1.0-preview4-final" but it went away if I used "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.1.0-preview4"

@pholly
Copy link

pholly commented Jan 13, 2017

@cda-1 That's interesting. Maybe because that version doesn't exist (doesn't show up in nuget package mgr) it's actually using the previous version 1.0.0-preview3-final?

@memark
Copy link

memark commented Jan 13, 2017

I can no longer find 1.2.0-preview4-22817 anywhere, including on the dev-feed. Luckily I had i cached, so now I'm commiting it to my repo and adding a local nuget feed for this package only.

The version numbers are a bit confusing. Has this "fix" been released in some other version that I should switch to?

@bricelam
Copy link
Contributor

If anyone here is interested in trying out the latest (MSBuild/VS2017) tools, see #7358 for details.

@marchy
Copy link

marchy commented Mar 3, 2017

We cannot roll back to '1.1.0-preview3-final' because it seems to be incompatible with current version of NuGet.

Help! Blocked on critical migration

Error: "The schema version of 'Microsoft.EntityFrameworkCore.Tools.DotNet' is incompatible with version 2.12.0.815 of NuGet"

@memark
Copy link

memark commented Mar 3, 2017

@marchy Have you tried using a more recent version of NuGet? 2.12 seems very old, as 3.5 was recently released. (Or are you stuck with VS 2013?)

@AdrienTorris
Copy link

AdrienTorris commented Jun 13, 2017

Same problem here ... I tried with different versions of Microsoft.EntityFrameworkCore.Tools.DotNet and the problem always occured. I use VS 2015, Update 3.

Part of my project.json :


 "dependencies": {
    "Remotion.Linq": "2.1.1",
    "Serilog.Sinks.RollingFile": "3.2.0",
    "Serilog.Extensions.Logging": "1.4.0-dev-10136",
    "System.Interactive.Async": "3.0.0",
    "Microsoft.AspNetCore.Diagnostics": "1.1.2",
    "Microsoft.AspNetCore.Mvc": "1.1.3",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.2",
    "Microsoft.AspNetCore.StaticFiles": "1.1.2",
    "Microsoft.Extensions.DependencyInjection.Abstractions": "1.1.1",
    "Microsoft.Extensions.Configuration.Binder": "1.1.2",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.2",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.2",
    "Microsoft.Extensions.Logging.Console": "1.1.2",
    "Microsoft.Extensions.Logging": "1.1.2",
    "Microsoft.EntityFrameworkCore.SqlServer.Design": "1.1.2",
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.1.2",
    "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.2",
    "Microsoft.AspNetCore.Authentication.Cookies": "1.1.2",
    "Microsoft.EntityFrameworkCore": "1.1.2",
    "Microsoft.Extensions.Logging.Debug": "1.1.2",
    "Microsoft.Extensions.Configuration.UserSecrets": "1.1.2",
    "Microsoft.Extensions.Configuration.Json": "1.1.2",
    "Microsoft.EntityFrameworkCore.Tools": "1.1.1",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.1.2"
  },
  "tools": {
    "Microsoft.Extensions.SecretManager.Tools": "1.1.0-preview4-final",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": "1.1.0-preview4-final",
    "Microsoft.EntityFrameworkCore.Tools": "1.1.1",
    "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.1.0-preview4-final"
  },
  "frameworks": {
    "net461": {
      "dependencies": {
        [...]
      }
    }
  },

@AdrienTorris
Copy link

After some tests I had to use the old version 1.0.0-preview3 and it did the job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

No branches or pull requests