none
Update-Database powershell scripts fails if Startup Project != Default project

    Question

  • PM> Update-Database -Verbose
    Using NuGet project 'RSP2.Competitions'.
    Using StartUp project 'RSP2.Competitions.Timer'.
    System.IO.FileNotFoundException: Could not load file or assembly 'RSP2.Competitions' or one of its dependencies. The system cannot find the file specified.
    File name: 'RSP2.Competitions'
       at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
       at System.Reflection.Assembly.Load(String assemblyString)
       at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.FindConfiguration()
       at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.GetMigrator()
       at System.Data.Entity.Migrations.Design.ToolingFacade.UpdateRunner.RunCore()
       at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.Run()

    Everything works fine if Startup Project == Default project

    Bug has been found in VS 2010 SP1 on EF 4.3 beta 1
    Wednesday, February 08, 2012 5:03 PM

All replies

  • This 'bug' is also in the final release. Annoying. You need to add -StartUpProjectName "Your Project Name" to the add-migration/update-database commands

    Sunday, February 12, 2012 2:34 PM