Entity Framework Migrations Error using Visual Studio 2013 - entity-framework

I am getting an error running Entity Framework migrations after updating to Visual Studio 2013.
PM> update-database
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Shell, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.VisualStudio.Shell, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetProjectTypes(Project project)
at System.Data.Entity.Migrations.Extensions.ProjectExtensions.IsWebSiteProject(Project project)
at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetTargetDir(Project project)
at System.Data.Entity.Migrations.MigrationsDomainCommand.GetFacade(String configurationTypeName)
at System.Data.Entity.Migrations.UpdateDatabaseCommand.<>c__DisplayClass2.<.ctor>b__0()
at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
Anybody know how to get around this?

I was able to fix this using the Microsoft Visual Studio 2012 Shell (Isolated) Redistributable Package. After I installed the package update-database worked correctly.
PM> update-database
Specify the '-Verbose' flag to view the SQL statements being applied to the target database.
No pending code-based migrations.
Running Seed method.

Update from EF 5 to EF >6, it works!

It's a known issue in EF 5 that is corrected in EF 6.
More details can be found here and here.

Related

EF Core Driver cannot load netstandard or one of its dependencies in LinqPad 5

I created a .NET Full Framework class library using EF Core v 2.2.1 and downloaded the EF Core driver v 2.x for Linqpad 5 (5.36.03), and when I try to create a new connection to the class library DLL, I get the following error message:
Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependenceis. The system cannot find the file specified.
I have clicked the 'Restore nuGet Dependencies' and it gives me the message 'No NuGet dependencies detected'.
Any thoughts?
Did exactly what #magicandre1981 suggested and targted 4.7.2 for my class library. That fixed it!

Changed Entity Framework v6 to Entity Framework v4.4 - getting error

I have created an ASP.NET MVC application and my Entity Framework version is 6.0.0, but I want Entity Framework version 4.4.0.
I have referenced version $.4.0 dll and also changed the version in package.config.
I am getting this error:
"Severity Code Description Project File Line Error CS1705 Assembly
'Microsoft.AspNet.Identity.EntityFramework' with identity
'Microsoft.AspNet.Identity.EntityFramework, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses
'EntityFramework, Version=6.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' which has a higher version than
referenced assembly 'EntityFramework' with identity 'EntityFramework,
Version=4.4.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' Final c:\users\navya\documents\visual
studio 2015\Projects\Final\Final\Models\IdentityModels.cs
Please let me know where I have to make changes when I change my Entity Framework versions in my reference.
Simply put - you can't do that. Identity library was compiled against EF6 and it won't work with lesser version. Upgrade path from 4 to 6 lists breaking changes that will not let you use v4 in any scenario.
You can get the source code, change EF version there, adjust source code to work with v4, build binaries, reference the binaries in your project directly without NuGet package => profit (or rather a step back and a maintenance nightmare)
Or you can build your own implementation of IUserStore that relies on EF4 and make Identity use your implementation.
Other than that you are out of luck. You shouldn't really use EF4, but I suspect this is not your decision to make.

Entity Framework Add-Migration fails with "Could not find assembly"

Using Package Manage Console in Visual Studio, when I run "Add-Migration MyMigrationName" on Company.Project1 (.NET Core 1.1) I get an error
Could not find assembly 'C:\path\to\my\solution\Company.Project2\.\bin\Debug\netcoreapp1.1\Company.Project1.dll'.
The project you are running migrations on must be the startup project.

CRM 2013: Error Custom Workflow Assembly Profiler

I'm trying to debug my custom workflow assembly using the plugin registration tool for the first time. We are using CRM 2013 on-premise version.
However in setting up the profiler, I got this error below about my mismatched version of 'Microsoft.Xrm.Sdk.Workflow'.
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Xrm.Sdk.Workflow, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)........................
I see that my Microsoft.Xrm.Sdk.Workflow version in the reference property is actually 5.0.0.0. However when I delete and re-add the reference (from the CRM 2013 SDK), then it shows a different version 5.0.9690.3739.
I read other questions about this, but I don't exactly understand how to synch the correct version together. Could someone please let me know how to do this step-by-step - if I need to change the one on the CRM server.
Notice the difference version between the two pics.

Entity Framework - can't enable code first migration

I am having some trouble enabling code first migration following the Microsoft Data Developer procedure at http://msdn.microsoft.com/en-us/data/jj591621.aspx
I am using Visual Studio 2010 and targeting .NET Framework 4.0
I can run the following steps without error:
Create a new MigrationsDemo Console application
Add the latest version of the EntityFramework NuGet package to the project.
Tools –> Library Package Manager –> Package Manager Console
Run the Install-Package EntityFramework command (This installs Entity Framework 5)
However I receive an error when attempting to run the "Enable-Migrations" command in Package Manager Console:
Type is not resolved for member 'System.Data.Entity.Migrations.Design.ToolingFacade+GetContextTypeRunner,EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
I would greatly appreciate any suggestions on what I can do to resolve this issue.
FYI I hit this problem as well with VS 2012 and .NET framework 4.0 what helped me was this answer https://stackoverflow.com/a/13572319/2259509 , its ridiculous but the ampersand does seem to cause this error
<Private>True</Private>
For me, the above was missing from the assembly reference in the csproj file.
This means on build it isn't copied, and so cannot be seen.
<Reference Include="Oracle.ManagedDataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=MSIL">
<HintPath>..\packages\Oracle.ManagedDataAccess.12.2.1100\lib\net40\Oracle.ManagedDataAccess.dll</HintPath>
<Private>True</Private>
</Reference>