New Posts New Posts RSS Feed: EF5 error on -update-database
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

EF5 error on -update-database

 Post Reply Post Reply
Author
Walid View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14-Nov-2010
Posts: 161
Post Options Post Options   Quote Walid Quote  Post ReplyReply Direct Link To This Post Topic: EF5 error on -update-database
    Posted: 26-Sep-2012 at 5:46am
Hi,

Having Code first models, I wanted to recreate my database using nuget (update-database ...).

I kept having this error:

PM> Update-Database -StartUpProjectName:"xxx.Application.Web" -ErrorVariable:myerror 
The project 'xxx.Application.Web' failed to build.

PM> $myerror
The project 'xxx.Application.Web' failed to build.
Au caractère C:\Dev\MigrationDFandCocktail2012\xxx\packages\EntityFramework.5.0.0\tools\EntityFramework.psm1:605 : 9
+         throw "The project '$projectName' failed to build."
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (The project 'xx...ailed to build.:String) [], RuntimeException
    + FullyQualifiedErrorId : The project 'xxx.Application.Web' failed to build.


The whole solution build in VS2012 !

This error was due to the presence of a devforce.cf file in the web project. I deleted it and the migration worked.
I have no clue why because of this file the build fail in nuget but not in VS.

I shared this, maybe some might have the same problem.





Edited by Walid - 26-Sep-2012 at 5:51am
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 26-Sep-2012 at 11:24am
Thanks Walid.
 
It looks like the build of the startup project will always fail the first time if there are multiple Code First models in the solution.  It wasn't removing the .cf file that fixed it, it was just the subsequent build.  But you don't need, or want, the .cf file anywhere other than in your Code First model projects, so it's a good idea to get rid of it.
 
The multi-model CF build problem is one we're aware of, and we know it's a huge pain.  We're working on a fix.
Back to Top
Walid View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14-Nov-2010
Posts: 161
Post Options Post Options   Quote Walid Quote  Post ReplyReply Direct Link To This Post Posted: 26-Sep-2012 at 11:37am
No really I think it's the .cf file which cause the error.

I tried to run update-database multiple times and each try failed when the file was there.
My settings in VS2012 doesn't allow more than 1 build in parallel to avoid the CF build issue (works fine like this, just take more time).
Once I deleted this file nuget was working.


I just made a quick test.
1. I did run update-database (no .cf file) => it worked
2. I added the .cf file and run update-database => it failed
3. run update-database => it failed
4. run update-database => it failed
5. delete the .cf file and run update-database => it worked
5. run update-database => it worked


So imo the presence of this file cause the error.
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 26-Sep-2012 at 12:02pm
OK, I believe you :).   If you install the DevForce Code First NuGet package to a project, in addition to adding the assembly references and .cf file it injects both PostSharp and DevForce into the MSBuild pipeline.  The presence of the .cf file is what will trigger DevForce to try its EntityModelMetadataDeploy task, and that's probably what's failing here.  If a project doesn't have a CF model, it's best not to install the Code First NuGet package to it to avoid the MSBuild injections.
 
Thanks again for reporting this.
Back to Top
asuvorov View Drop Down
Newbie
Newbie
Avatar

Joined: 24-Aug-2012
Location: Burlington, VT
Posts: 5
Post Options Post Options   Quote asuvorov Quote  Post ReplyReply Direct Link To This Post Posted: 28-Sep-2012 at 1:34pm
Just confirm the same issue on my side.

I've been working on my VS2010 DevForce2010 project and everything was great until I decided to upgrade to VS2012. Why I needed that is a long story (EF5 enums -> .Net 4.5 -> VS2012 -> DF2012). Overall this bundle VS2012+DevForce2012 looks quite flimsy. Maybe I need time to get used to this but so far these two betas kill me. :(
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 28-Sep-2012 at 2:11pm
Sorry to hear that, Aleksey. 
 
The is the first beta release of both Cocktail 2012 and DevForce 2012, so there are bound to be some issues.
 
What other areas have you found to be flimsy?   
 
I should add, too, that although DF2012 is using EF 5, it doesn't yet support Enum types, that's coming soon.
Back to Top
asuvorov View Drop Down
Newbie
Newbie
Avatar

Joined: 24-Aug-2012
Location: Burlington, VT
Posts: 5
Post Options Post Options   Quote asuvorov Quote  Post ReplyReply Direct Link To This Post Posted: 28-Sep-2012 at 3:01pm
Kim, thank you for the information! So, DF2012 does not support enums yet, huh? Okay, then I should not bother with migrating to VS2012, not now at least. I'll rollback.

I've installed VS2012 just today and tried to migrate my project to that. Surprisingly I got VS crashed couple of times just while typing something in editor. Also I am having problems with Postsharp, it does not show me its settings in project's properties anymore. I've tried to re-install it several times but did not get it fixed. I guess I need to check it with PostSharp guys.

Probably I was inaccurate saying that DF2012 is flimsy, I did not mean that, sorry. That was just my frustration related to wasted work day. I cannot use DF2012 yet, but believe it will be solid as a rock when all important bugs get fixed.  It's a great stuff after all, I look forward to using it in my projects. 

Thanks!
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 28-Sep-2012 at 3:23pm
I've had VS crash on me before too.  Make sure you've installed the RTM, as it is more stable.
 
PostSharp is moving towards a NuGet only distribution, which is what DF2012 is using to install its PostSharp support.  I admit we're still learning about the changes too, but the PostSharp Project Settings tab is not available when PostSharp is installed via NuGet, so that's why you don't see it.  It might still be provided if you download the PostSharp exe, but I haven't checked.
 
Our DF2012 documentation, especially migration documentation, is still a work in progress, so I know that can make things even more frustrating.
 
Thanks for your feedback.
 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down