`
public class TestDbContext : DbContext
{
public DbSet
public TestDbContext() : base()
{
}
public TestDbContext(DbContextOptions<TestDbContext> options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
}
}
public class TemporaryDbContextFactory : IDbContextFactory<TestDbContext>
{
public TestDbContext Create(DbContextFactoryOptions options)
{
var builder = new DbContextOptionsBuilder<TestDbContext>();
builder.UseSqlServer("##SQLConnectionString##");
return new TestDbContext(builder.Options);
}
}
public class Program
{
public static void Main(string[] args)
{
}
}
`
` public class TestModel
{
[Key]
public int Id { get; private set; }
public string Value { get; private set; }
}`
'{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.1",
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
}
},
"tools": {
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"net4.6.1": {}
}
}
'
'{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.1.0-preview4-final",
"type": "build"
}
},
"tools": {
"Microsoft.EntityFrameworkCore.Tools.DotNet": "1.1.0-preview4"
},
"frameworks": {
"net4.6.1": {}
}
}
'
Work around
The biggest issue I have is that I now cant downgrade the project as i get the same error and have to recreate the project (pain in the butt).
Unable to run EF commands / EF does not work on the new EF 1.1.0 when upgrading from 1.0.1 / Tools does not work not sure which...
Exception message:
targets framework 'net4.6.1'. The Entity Framework Core Package Manager Console Tools don't support this framework.
EF Core version: .NET 4.6.1
Operating system: Windows 8.1
Visual Studio version: VS 2015
Can you change:
"frameworks": {
"net4.6.1": {}
}
to (note the removal of .
s):
"frameworks": {
"net461": {}
}
@rowanmiller changed the framework (was I always doing it wrong or have they changed it?) anyway I'm now getting the following error
Unrecognized option '--config'
`{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.1.0-preview4-final",
"type": "build"
}
},
"tools": {
"Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4",
"Microsoft.EntityFrameworkCore.Tools.DotNet": "1.1.0-preview4"
},
"frameworks": {
"net461": {}
}
}`
Cannot execute this command because 'Microsoft.EntityFrameworkCore.Tools' is not installed in project 'EF.Console.Core'. Add 'Microsoft.EntityFrameworkCore.Tools' to the 'tools' section in project.json. See http://go.microsoft.com/fwlink/?LinkId=798221 for more details.
No executable found matching command "dotnet-ef"
this error makes sense.
On the plus side I was able to downgrade back to 1.0.0-preview2 after upgrading to 1.1.0-preview4 without an issue :)
@TPJ11 having the periods was always wrong, but it looks like some of the project tooling was smart enough to "know what you meant" 馃槃.
The Unrecognized option '--config'
issue is tracked by #7071 - unfortunately there isn't a good workaround, but you can roll back to the preview3 tools and keep using the 1.1 runtime. There are details about this in #7071.
BTW you can remove "Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4",
from the tools
section, just the ...Tools.DotNet
package needs to be there. It won't really change anything, it's just redundant.
Closing as the issue you are hitting how is already tracked elsewhere.
Most helpful comment
@TPJ11 having the periods was always wrong, but it looks like some of the project tooling was smart enough to "know what you meant" 馃槃.
The
Unrecognized option '--config'
issue is tracked by #7071 - unfortunately there isn't a good workaround, but you can roll back to the preview3 tools and keep using the 1.1 runtime. There are details about this in #7071.BTW you can remove
"Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4",
from thetools
section, just the...Tools.DotNet
package needs to be there. It won't really change anything, it's just redundant.Closing as the issue you are hitting how is already tracked elsewhere.