简体   繁体   English

ReflectionTypeLoadException在程序包管理器控制台中运行add-migration命令时出错

[英]ReflectionTypeLoadException Error running add-migration command in package manager console

I'm using EF7 for a Windows 10 UWP. 我将EF7用于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 我正在Visual Studio 2015中的程序包管理器控制台中运行命令add-migration "test"

System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. System.Reflection.ReflectionTypeLoadException:无法加载一个或多个请求的类型。 Retrieve the LoaderExceptions property for more information. 检索LoaderExceptions属性以获取更多信息。

How the hell do you retrieve the LoaderExceptions property? 您如何检索LoaderExceptions属性? 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. 我看过的每个博客文章或stackoverflow问题都假定我可以通过C#进行访问,或者简单地重新启动VS2015即可解决此问题。

I'm not very familiar with PowerShell , but I have tried the following: 我对PowerShell不太熟悉,但是我尝试了以下操作:

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 这是我的project.json文件

{
  "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". 使用nuget软件包管理器控制台执行这些操作1-通过“ enable-migrations”启用迁移。 2- add new migration by " add-migrationb X" : X is custom migration name 3- update database by "update-database" 2-通过“ add-migrationb X”添加新迁移:X是自定义迁移名称3-通过“ update-database”更新数据库

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 是否有执行与添加迁移相同的 function 的 EF Core Package 管理器控制台命令<name> EF6 中的 -IgnoreChanges 命令</name> - Is there an EF Core Package Manager Console command that performs the same function as the Add-Migration <name> -IgnoreChanges command in EF6 Add-Migration 命令在我的 .NET 6 项目中有错误 - Add-Migration command has an error in my .NET 6 project Add-Migration导致InvalidOperationException错误。 正确的命令是什么? - Add-Migration results in InvalidOperationException error. What is the correct command? 没有nuget包的Add-Migration是否可能? - Add-Migration without nuget package possible? 运行添加迁移时获取SerializationException - Getting SerializationException when running add-migration add-migration命令在ApplicationDbContex上失败 - add-migration command fails on ApplicationDbContex 添加迁移命令仅提示“ScriptHalted” - Add-Migration command only prompt “ScriptHalted” Add-Migration错误:指定的架构无效 - Add-Migration error: Schema specified is not valid 实体框架核心中的添加迁移错误 - Add-Migration Error in Entity Framework Core 添加迁移挂起使用上下文 - 没有错误 - Add-Migration hangs on using context - no error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM