There are MANY MANY posts on the same issue.
The issue: I am developing a C# Console Application with Entity Framework 6.1.3. Code-First.
Until last week, I was running on my Windows 7 machine and VS 2013, and I was doing add-migrations just fine.
Now I have a new machine (Lenovo), running Visual Studio 2015 Community edition on a x64 Windows 10 machine. I can no longer add-migration (on the same code-base... clean github clone).
Running add-migration from the PM console yields the following error:
PM> add-migration test2
System.BadImageFormatException: Could not load file or assembly 'XXXX' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: 'XXXX'
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) ...
I have several projects in this solution. I have confirmed:
1) Properties of all projects show x64.
2) They all target .NET 4.5
3) Build > Configuration Manager
shows all are "Any CPU".
4) Checked Tools > Options > Builds
and found nothing related to x86 builds.
5) Search Windows Explorer for the text "x86" ANYWHERE in my tree. Nothing found.
All posts (and there are many of them) on this subject point to the issue being that some file is being compile as 32 bit whereas the startup project is 64. I'm not sure where else to check that this is not my issue other than the properties of all the projects in my solution. So I can't help but think that there is some other setting in this new VS2015 Community edition that I am not seeing?
The solution compiles with no error and runs but I cannot add-migration.
Any help would be truly appreciated. I've spent a day on this. I've tried editing the registry to add keys the Fusion to enable more logging and restarted VS but I did not see any change in logging.
Thanks -Ed