C# 添加迁移异常
当我尝试添加迁移时,出现以下错误:C# 添加迁移异常,c#,entity-framework,entity-framework-migrations,C#,Entity Framework,Entity Framework Migrations,当我尝试添加迁移时,出现以下错误: PM> add-migration RestrictPromotionContentAndTitle System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assemb
PM> add-migration RestrictPromotionContentAndTitle
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
at BrightInfo.Infrastructure.Settings.DbAudit.AuditDbContext..ctor(String connString)
at BrightInfo.Infrastructure.Settings.BrightInfoContext..ctor(Boolean proxyCreationEnabled, Boolean lazyLoadingEnabled) in C:\Projects\BrightInfo\BrightInfo.Infrastructure.Settings\BrightInfoContext.cs:line 124
at BrightInfo.Infrastructure.Settings.BrightInfoContext..ctor() in C:\Projects\BrightInfo\BrightInfo.Infrastructure.Settings\BrightInfoContext.cs:line 113
--- End of inner exception stack trace ---
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at System.Data.Entity.Infrastructure.DbContextInfo.<CreateActivator>b__0()
at System.Data.Entity.Infrastructure.DbContextInfo..ctor(Type contextType, DbProviderInfo modelProviderInfo, AppConfig config, DbConnectionInfo connectionInfo)
at System.Data.Entity.Infrastructure.DbContextInfo..ctor(Type contextType)
at System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration, DbContext usersContext)
at System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration)
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()
Exception has been thrown by the target of an invocation.
有人知道怎么修吗?
谢谢。您的项目中似乎没有正确的dll引用 无法加载文件或程序集“Microsoft.Build.Framework,版本=15.1.0.0,区域性=neutral,PublicKeyToken=b03f5f7f11d50a3a”或其依赖项之一。系统找不到指定的文件。 在 如果可以添加适当的dll和清理解决方案,请重新生成解决方案,然后重试,您应该可以成功执行。如果进一步的错误仍然存在,请发布您的迁移详细信息,以便更好地理解和帮助您
HTH项目中似乎没有正确的dll引用 无法加载文件或程序集“Microsoft.Build.Framework,版本=15.1.0.0,区域性=neutral,PublicKeyToken=b03f5f7f11d50a3a”或其依赖项之一。系统找不到指定的文件。 在 如果可以添加适当的dll和清理解决方案,请重新生成解决方案,然后重试,您应该可以成功执行。如果进一步的错误仍然存在,请发布您的迁移详细信息,以便更好地理解和帮助您 HTH我通过添加以下内容对其进行了修复: {get;set;} 对于我的所有属性我通过添加以下内容对其进行了修复: {get;set;}
到我的所有属性您上次做的更改是什么?这是我第一次尝试在Visual Studio 2017中迁移。您上次做的更改是什么?这是我第一次尝试在Visual Studio 2017中迁移。是的,我通过相对链接了解了此问题,并将其更改为绝对路径。但这没有帮助。是的,我已经通过相对链接了解了这个问题,并将它们改为绝对路径。但这没有帮助。
Unable to find type [NuGet.PackageManager]. Make sure that the assembly that contains this type is loaded.
At C:\Projects\BrightInfo\packages\T4Scaffolding.Core.1.0.0\tools\init.ps1:4 char:5
+ if ([NuGet.PackageManager].Assembly.GetName().Version -lt 1.4)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (NuGet.PackageManager:TypeName) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound