locked
Enable-Migrations and project 'dpFinMvvm' failed to build. RRS feed

  • Question

  • Hi All,

    I have created a sample WPF project, worked fine.

    I added a MVVMLight project, made it a default startup project, and ran fine.

    Now I added a class library project, and added an ADO.NET data model with "Code First From Database", and selected relevant tables, that gave me a good collection of entity classes.

    I thought this way, I can keep my data model seperate from presentation and businesss logic layers, plus add additional target plateforms if needed and take the advantage of SoC.

    So far so good.

    Now I want to enable Migrations on my data layer only. I fired up Nuget console, selected dataLayer project in the "Default Project" drop down. Issued Enable-Migrations command and very first error I got was

    --------------------

    "No connection string named 'dpFinDataModel' could be found in the application config file."

    --------------------

    Now I modified Startup project - i.e. Mvvm project's App.Config to add App.Config details from DataLayer project.

    Tried to rerun "Enable-Migrations", and following error occured:

    --------------------

    PM> Enable-Migrations

    The project 'dpFinMvvm' failed to build.

    --------------------

    Am I doing something wrong here?

    Will this approach work?

    Thanks for all your help.

    -DP

    Wednesday, June 17, 2015 3:11 PM

Answers

  • Hello drpdp,

    Code first migration would depend on the _MigrationHistory table, however, if you use the Code First From database, after enabling the migration, it would create another database which only contains tables without any data I think it would be not what you want.

    If you want to use code first migration, please ensure your database is created from your model and contains a _MigrationHistory table.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Fred Bao Friday, June 26, 2015 2:39 AM
    Thursday, June 18, 2015 2:45 AM