简体   繁体   中英

ReflectionTypeLoadException Error running add-migration command in package manager console

I'm using EF7 for a Windows 10 UWP.

This is an extreme source of frustration for me. I'm running the command add-migration "test" from the package manager console in Visual Studio 2015. I'm getting the error

System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

How the hell do you retrieve the LoaderExceptions property? Every blog post or stackoverflow question I've looked at assumes that I've got access to this via C#, or a simple restart of VS2015 will fix this.

I'm not very familiar with PowerShell , but I have tried the following:

try { add-migration "test" } catch [System.Reflection.ReflectionTypeLoadException] {Write-Host "LoaderExceptions: $($_.Exception.LoaderExceptions)"}

Sadly, I don't get the error details I expected (on another note, how do you enable multiline in the console???).

Here's my project.json file

{
  "dependencies": {
    "EntityFramework.Commands": "7.0.0-rc1-final",
    "EntityFramework.Core": "7.0.0-rc1-final",
    "EntityFramework.SQLite": "7.0.0-rc1-final",
    "FubarCoder.RestSharp.Portable": "3.1.0",
    "FubarCoder.RestSharp.Portable.OAuth": "3.1.0",
    "LightInject": "4.0.4",
    "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0",
    "Newtonsoft.Json": "8.0.2"
  },
  "frameworks": {
    "uap10.0": {}
  },
  "runtimes": {
    "win10-arm": {},
    "win10-arm-aot": {},
    "win10-x86": {},
    "win10-x86-aot": {},
    "win10-x64": {},
    "win10-x64-aot": {}
  }
}

Do these using nuget package manager console 1- enable migration by "enable-migrations". 2- add new migration by " add-migrationb X" : X is custom migration name 3- update database by "update-database"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM