Cant run migrations in UWP app

c# entity-framework entity-framework-core sqlite uwp

Question

Ive been dealing with this for a few days and Im driving crazy here. I created a uwp project that uses SQLite and EF Core to handle database layer and I had to add more columns to the entities I created at the beginning. I used Code-First approach and I was able to run my first migration (created the Migrations folder with the migration class and the snapshot). But when I try to run the 'Add-Migrations SecondMigration' command I get the following error.

PM> Add-Migration MigrationPk To undo this action, use Remove-Migration. Add-Migration : Cannot add the link because the source file '' cannot be found. At line:1 char:2 + Add-Migration MigrationPk + ~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (:) [Add-Migration], COMException + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Add-Migration

I have installed the following:

"Microsoft.EntityFrameworkCore.Sqlite": "1.1.2",
"Microsoft.EntityFrameworkCore.Tools": "1.1.1",
"Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2"

And I have the following project structure:

-UWP project (using PRISM framework) -DAL class library project -LogicUI class library (view models) -Utils class library project -Test projects

I also tried to run the 'Add-Migration' command by using the context, project, and startProject as described here: https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/powershell

I also uninstalled and installed again EF core without any luck

Any ideas? Thanks guys!

1
1
6/12/2017 3:35:48 AM

Popular Answer

Looks like the issue was that I had the db name in a constant. When I moved away from there and "hardcoded" in the dbcontext the migrations started to work

0
6/26/2017 8:06:13 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow