{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/EntityFramework6/issues/382","repository_url":"https://api.github.com/repos/aspnet/EntityFramework6","labels_url":"https://api.github.com/repos/aspnet/EntityFramework6/issues/382/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework6/issues/382/comments","events_url":"https://api.github.com/repos/aspnet/EntityFramework6/issues/382/events","html_url":"https://github.com/aspnet/EntityFramework6/issues/382","id":266918215,"node_id":"MDU6SXNzdWUyNjY5MTgyMTU=","number":382,"title":"Add-Migration and Update-Database fail because of attempt to load assembly Microsoft.Build.Framework","user":{"login":"CZEMacLeod","id":7670113,"node_id":"MDQ6VXNlcjc2NzAxMTM=","avatar_url":"https://avatars3.githubusercontent.com/u/7670113?v=4","gravatar_id":"","url":"https://api.github.com/users/CZEMacLeod","html_url":"https://github.com/CZEMacLeod","followers_url":"https://api.github.com/users/CZEMacLeod/followers","following_url":"https://api.github.com/users/CZEMacLeod/following{/other_user}","gists_url":"https://api.github.com/users/CZEMacLeod/gists{/gist_id}","starred_url":"https://api.github.com/users/CZEMacLeod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CZEMacLeod/subscriptions","organizations_url":"https://api.github.com/users/CZEMacLeod/orgs","repos_url":"https://api.github.com/users/CZEMacLeod/repos","events_url":"https://api.github.com/users/CZEMacLeod/events{/privacy}","received_events_url":"https://api.github.com/users/CZEMacLeod/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"ajcvickers","id":1430078,"node_id":"MDQ6VXNlcjE0MzAwNzg=","avatar_url":"https://avatars1.githubusercontent.com/u/1430078?v=4","gravatar_id":"","url":"https://api.github.com/users/ajcvickers","html_url":"https://github.com/ajcvickers","followers_url":"https://api.github.com/users/ajcvickers/followers","following_url":"https://api.github.com/users/ajcvickers/following{/other_user}","gists_url":"https://api.github.com/users/ajcvickers/gists{/gist_id}","starred_url":"https://api.github.com/users/ajcvickers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajcvickers/subscriptions","organizations_url":"https://api.github.com/users/ajcvickers/orgs","repos_url":"https://api.github.com/users/ajcvickers/repos","events_url":"https://api.github.com/users/ajcvickers/events{/privacy}","received_events_url":"https://api.github.com/users/ajcvickers/received_events","type":"User","site_admin":false},"assignees":[{"login":"ajcvickers","id":1430078,"node_id":"MDQ6VXNlcjE0MzAwNzg=","avatar_url":"https://avatars1.githubusercontent.com/u/1430078?v=4","gravatar_id":"","url":"https://api.github.com/users/ajcvickers","html_url":"https://github.com/ajcvickers","followers_url":"https://api.github.com/users/ajcvickers/followers","following_url":"https://api.github.com/users/ajcvickers/following{/other_user}","gists_url":"https://api.github.com/users/ajcvickers/gists{/gist_id}","starred_url":"https://api.github.com/users/ajcvickers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajcvickers/subscriptions","organizations_url":"https://api.github.com/users/ajcvickers/orgs","repos_url":"https://api.github.com/users/ajcvickers/repos","events_url":"https://api.github.com/users/ajcvickers/events{/privacy}","received_events_url":"https://api.github.com/users/ajcvickers/received_events","type":"User","site_admin":false}],"milestone":null,"comments":29,"created_at":"2017-10-19T17:05:07Z","updated_at":"2018-09-26T20:31:27Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"With VS2017 15.4 or 15.5 (Preview), I regularly get a fail when adding or applying migrations due to the error\r\n`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.`\r\n\r\nThe result from e.g. Update-Database is \r\n```\r\nSpecify the '-Verbose' flag to view the SQL statements being applied to the target database.\r\nSystem.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.\r\nFile name: 'Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'\r\n   at xxxxxx.Migrations.Configuration..ctor()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Data.Entity.Migrations.Utilities.MigrationsConfigurationFinder.FindMigrationsConfiguration(Type contextType, String configurationTypeName, Func`2 noType, Func`3 multipleTypes, Func`3 noTypeWithName, Func`3 multipleTypesWithName)\r\n   at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.FindConfiguration()\r\n   at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.GetMigrator()\r\n   at System.Data.Entity.Migrations.Design.ToolingFacade.UpdateRunner.RunCore()\r\n   at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.Run()\r\n```\r\n\r\nObviously my class library and main project do not include any references to MSBuild Framework and the update does work at runtime.\r\n\r\nClosing VS and re-opening then running the command before doing anything else _sometimes_ seems to resolve the issue.\r\nI did find a proposed solution online which involved editing `DevEnv.exe.config` and replacing the relative path for the codebase element with an absolute path - although this doesn't seem to have worked in my case.\r\n```\r\n      <dependentAssembly>\r\n        <assemblyIdentity name=\"Microsoft.Build.Framework\" publicKeyToken=\"b03f5f7f11d50a3a\" culture=\"neutral\" />\r\n        <bindingRedirect oldVersion=\"2.0.0.0-99.0.0.0\" newVersion=\"15.1.0.0\" />\r\n        <codeBase version=\"15.1.0.0\" href=\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\MSBuild\\15.0\\Bin\\Microsoft.Build.Framework.dll\" />\r\n      </dependentAssembly>\r\n```\r\nThis could be a red-herring however, as the solution said to close VS, edit the .config and then re-open which in my case seems to resolve the issue (temporarily) anyway.\r\n\r\nAdding that section to my web.config results in a different error `Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)`\r\n\r\nAny guidance or ideas?\r\n\r\nN.B. this happens to me with both EF 6.1.3 and the latest 6.2.0-beta2-60920 and I am targeting net461."},"comment":{"url":"https://api.github.com/repos/aspnet/EntityFramework6/issues/comments/424859371","html_url":"https://github.com/aspnet/EntityFramework6/issues/382#issuecomment-424859371","issue_url":"https://api.github.com/repos/aspnet/EntityFramework6/issues/382","id":424859371,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNDg1OTM3MQ==","user":{"login":"gabbsmo","id":1475256,"node_id":"MDQ6VXNlcjE0NzUyNTY=","avatar_url":"https://avatars2.githubusercontent.com/u/1475256?v=4","gravatar_id":"","url":"https://api.github.com/users/gabbsmo","html_url":"https://github.com/gabbsmo","followers_url":"https://api.github.com/users/gabbsmo/followers","following_url":"https://api.github.com/users/gabbsmo/following{/other_user}","gists_url":"https://api.github.com/users/gabbsmo/gists{/gist_id}","starred_url":"https://api.github.com/users/gabbsmo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabbsmo/subscriptions","organizations_url":"https://api.github.com/users/gabbsmo/orgs","repos_url":"https://api.github.com/users/gabbsmo/repos","events_url":"https://api.github.com/users/gabbsmo/events{/privacy}","received_events_url":"https://api.github.com/users/gabbsmo/received_events","type":"User","site_admin":false},"created_at":"2018-09-26T20:31:27Z","updated_at":"2018-09-26T20:31:27Z","author_association":"NONE","body":"@ajvickers I am using the Azure, Office and Web workloads VS 2017 1.5.8.  Application is based on the MVC 5 template in VS 2015. I also have Web API 2 code in it. I am not able to post code at this time. "}}
{"actor":{"display_login":"gabbsmo"}}