none
Entity Framework - Enable-Migrations Issue

    Question

  • I am building a project in VS 2015 and I am trying to enable-migrations to create a database using Entity Framework, but I am getting an error:

    
    
    Cannot determine a valid start-up project. Using project 'DataManager' instead. Your configuration file and working directory may not be set as expected. Use the -StartUpProjectName parameter to set one explicitly. Use the -Verbose switch for more information.No context type was found in the assembly 'DataManager'.

    I found several threads and potential solutions, but no luck. So far I have tried:

    1. Rebuilding the Solution and Resetting VS

    2. I confirmed that the default project is set to 'DataManager' with both a 'nuget.org' and 'All' package source

    3. Enable-Migrations -ProjectName DataManager

    4. I reinstalled with the commmand: Install-Package EntityFramework -IncludePrerelease

    What am I missing?

    Friday, December 02, 2016 3:30 AM

All replies

  • Hi pdevito3,

    According to the error message, when you execute enable-migrations command, it could not find a valid start-up project from your Solution. So please check whether you have set a valid start-up project in your solution. Please right-click the DataManager project in Solution Explorer to set it as start-up project.

    Please note, the DataManager should be a valid start-up project, such as Console application, WinForm application and so on. If it is a project lick Class Library, it should be not a valid start-up project.

    In addition, following document introduce Entity Framework Code First Migrations. Please refer to the Enabling Migrations part to check whether there has any difference with your steps. 

    https://msdn.microsoft.com/en-us/library/jj591621(v=vs.113).aspx#Anchor_1

    If all above steps could not resolve your problem, please share your solution structure and the detailed steps that you operated, which could help us reproduce your problem.

    Best Regards,
    Weiwei


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, December 20, 2016 6:42 AM
    Moderator