Error : Entity Framework : Update-Database
PM> Update-Database -ConnectionString "data source=.;Integrated Security=true;initial catalog=my_db" -ConnectionProviderName "System.Data.SqlClient" -Verbose
Using StartUp project 'Integration Services Project1'.
Using NuGet project 'MyDataProject'.
Exception calling "SetData" with "2" argument(s): "Type 'Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt' in assembly 'Microsoft.DataWarehouse.VsIntegration,
Version=13.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' is not marked as serializable."
At C:\Source\Repos\MyApplication\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:720 char:5
+ $domain.SetData('startUpProject', $startUpProject)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : SerializationException
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetProjectTypes(Project project, Int32 shellVersion)
at System.Data.Entity.Migrations.Extensions.ProjectExtensions.IsWebProject(Project project)
at System.Data.Entity.Migrations.MigrationsDomainCommand.GetFacade(String configurationTypeName, Boolean useContextWorkingDirectory)
at System.Data.Entity.Migrations.UpdateDatabaseCommand.<>c__DisplayClass2.<.ctor>b__0()
at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
Object reference not set to an instance of an object.
How to fix:
- In Package Manager Console, make sure "Default Project" is set to the project that has Data Migrations enabled
- Make sure the Web Project is set as the Start project (I know crazy)
- Make sure the database connection string is correct.
Error:
Severity Code Description Project File Line Suppression State
Error CS0433 The type 'DatabaseGeneratedOption' exists in both 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' MyApplications C:\Source\Repos\MyApplications\Models\ApplicationType.cs 98 Active
Fix:
The generated Sitefinity Assembly has a different Target .NET Framework.
Right Click a Project > Choose Properties > Ensure all Target Framework versions are the same. (Example 4.5)