EF Tools 1.1.0-preview4 Unrecognized option '--config'
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
- Upgrade nuget packages from v1.0.1 to v1.1.0.
- Use 'dotnet ef' to generate migrations
- 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%" ]
}
}
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"
]
}
},
More on the topic #7076
I have a similar problem Unrecognized option '--config'
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"
},
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.
This is fixed in dev (could become 1.1.0-preview5) and dev2 (will become 1.0.0-msbuild2).
@bricelam does just using preview3 for full .NET projects seem like the best workaround to you?
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.
Using the nightly builds would solve both problems π
@bricelam - If CI passes. π
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?
Just edit project.json and change the tools back to 1.0.0-preview3. It works with the latest EntityFrameworkCore (v1.1.0).
The nightly feed is available here.
@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!
@bricelam Working excellently in 1.2.0-preview4-22817. Thanks!
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.
@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).
@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.
@bricelam
Package Microsoft.EntityFrameworkCore.Tools.DotNet 1.2.0-preview4-22878 is not compatible with net461
@AR1ES - Are you using project.json based project? If yes then you need to put Tools.DotNet package under "tools" node instead of "dependencies".
@smitpatel , thanks. Tools.DotNet was under tools section and under dependencies.