none
Getting exception in 'add-migrations' command (and related questions about proper installation of EntityFramework 4.3.1 NuGet Package in VS2010) RRS feed

  • Question

  • I'm getting various errors when running the 'add-migration' command in the PMC...  but first here's some background that might be important...

    I'm working on a large WPF/WCF solution which has 4 projects that have references to the EF assembly: the Services project (which has the DbContext's), a Common project , Test (unit tests) and the UI project. 

    Based on what I see in the Manage Packages "Select Projects" window, during the install of the EF NuGet package, it somehow got "installed" into the Services, Common and Test projects, but not into the UI. 

    - Should the EF 4.3.1 NuGet package be "installed" into ALL projects that reference the EF assembly?

    - What does it mean to have the package "installed" into a project?

    Now to the errors:

    Earlier I was getting a "ReflectionTypeLoadException: Unable to load one or more of the requested types" error when I ran add-migration (see my earlier post)

    But after some experimentation, I'm now getting the errors below. Note that the first time I ran add-migration, I had the Services project as the StartUp, and the second time I had the UI project as the Startup.

    But both failed.

    Any idea what's going on here???

    DadCat

    PM> add-migration App_AddKiiiWorkPath -conf App -verbose
    Using NuGet project 'xxx.Services'.
    Using StartUp project 'xxx.Services'.
    System.Management.Automation.RuntimeException: The project 'xxx.Services' failed to build.
    The project 'xxx.Services' failed to build.     [but notice there was no detail shown, even though I specified -verbose]

    PM> add-migration App_AddKiiiWorkPath -conf App -verbose
    Using NuGet project 'xxx.Services'.
    Using StartUp project 'xxx.UI'.
    System.IO.FileNotFoundException: Could not load file or assembly 'xxx.Services' or one of its dependencies. The system cannot find the file specified.
    File name: 'xxx.Services'
       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.GetPendingMigrationsRunner.RunCore()
       at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.Run()

    Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
    Running under executable  C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe
    --- A detailed error log follows.

    === Pre-bind state information ===
    LOG: User = xxxx
    LOG: DisplayName = xxx.Services
     (Partial)
    WRN: Partial binding information was supplied for an assembly:
    WRN: Assembly Name: xxx.Services | Domain ID: 71
    WRN: A partial bind occurs when only part of the assembly display name is provided.
    WRN: This might result in the binder loading an incorrect assembly.
    WRN: It is recommended to provide a fully specified textual identity for the assembly,
    WRN: that consists of the simple name, version, culture, and public key token.
    WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
    LOG: Appbase = file:///C:/Projects/xxx/src/Development/xxx/xxx.UI/bin/Debug/
    LOG: Initial PrivatePath = NULL
    Calling assembly : (Unknown).
    ===
    LOG: This bind starts in default load context.
    LOG: Using application configuration file: C:\Projects\xxx\src\Development\xxx\xxx.UI\tmp10B8.tmp
    LOG: Using host configuration file:
    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
    LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
    LOG: Attempting download of new URL file:///C:/Projects/GeophysicalInsights/src/Development/xxx/xxx.UI/bin/Debug/xxx.Services.DLL.
    LOG: Attempting download of new URL file:///C:/Projects/GeophysicalInsights/src/Development/xxx/xxx.UI/bin/Debug/xxx.Services/xxx.Services.DLL.
    LOG: Attempting download of new URL file:///C:/Projects/GeophysicalInsights/src/Development/xxx/xxx.UI/bin/Debug/xxx.Services.EXE.
    LOG: Attempting download of new URL file:///C:/Projects/GeophysicalInsights/src/Development/xxx/xxx.UI/bin/Debug/xxx.Services/xxx.Services.EXE.

    Could not load file or assembly 'xxx.Services' or one of its dependencies. The system cannot find the file specified.

     

     

      

    Wednesday, June 20, 2012 9:57 PM

Answers

  • Hi DadCat,

    Welcome to MSDN Forum.

    We need to install Entity Framework package in every projects which we will use Entity Framework. The packaged installed into a project means this project has already have all the references of Entity Framework dll files which we will use.

    Based on the exception message, I think the startup project doesn't been set correctly. If we want to add migration, the startup project should be the project which enabled migrations.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by DadCat Thursday, June 28, 2012 2:13 PM
    Friday, June 22, 2012 5:21 AM
    Moderator

All replies

  • Hi DadCat,

    Welcome to MSDN Forum.

    We need to install Entity Framework package in every projects which we will use Entity Framework. The packaged installed into a project means this project has already have all the references of Entity Framework dll files which we will use.

    Based on the exception message, I think the startup project doesn't been set correctly. If we want to add migration, the startup project should be the project which enabled migrations.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by DadCat Thursday, June 28, 2012 2:13 PM
    Friday, June 22, 2012 5:21 AM
    Moderator
  • Hi DadCat,

    Any update about this issue? If you need further help, I will be more than happy to be of assistance. :)

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, June 26, 2012 3:30 AM
    Moderator