简体   繁体   中英

Trying to use migrations in a project other then the startup project results in error

Hi I am trying to take advantage of Entity Framework migrations but when I add this command:

PM> Add-Migration

cmdlet Add-Migration at command pipeline position 1

Supply values for the following parameters:

Name: CodeArtMigration

I get back this error message:

Cannot determine a valid start-up project. Using project 'CodeArt.DataAccess' 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 packages installed. The EntityFramework package is not installed on project 'CodeArt.DataAccess'.

The last part of the message that says that Entity Framework is not available in he current project is not true because I do have a reference to Entity Framework.

The package source is set to Microsoft and .NET but I als My code is structured in 3 layers I wanted to add the migration data in my DataAccess layer.Also I wanted to minimize thereference to Entity Framework only in my data access layer.

Make sure that your Package Manager Console has the right project selected in the drop down labeled "Default project:" to the upper right of Package Manager Console window in Visual Studio.

Here's where to find it in Visual Studio 2015:
在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM