Sep 06, 2013 · 1 minute read
I recently spent several hours tearing my hair out try to figure out why Entity Framework was preventing me from adding a migration to my project. I made some very simple changes to my existing model (I’m developing using the Entity Framework Code First approach) and when trying to add a migration, I was presented with the following error message;
But how can this be? For you see, my project does build…
My project not only builds, but it runs and works just fine … (up until the point where Entity Framework complains about the out of date model of course!).
It was only after considerable head scratching, and tinkering, that I came across the solution. My project specifically targets the x86 platform, as shown below;
If I go ahead and change the build configuration to ‘Any CPU’ … I am greeted with a couple of dozen build errors, all relating to missing references! Once I resolved these issues, I was once again able to create migrations. Apparently Entity Framework builds your project in ‘Any CPU’ when creating migrations (and probably when issuing other commands as well). Hopefully this will help resolve your problem as well.
About the author
I am Jon Preece, an experienced website and software developer from the United Kingdom, based in Manchester.
Throughout my 10+ year professional career I have worked in many sectors, including; e-commerce, financial services, marketing, healthcare, travel and accountancy. Get in touch via Twitter.