{"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":50,"created_at":"2017-10-19T17:05:07Z","updated_at":"2018-11-07T10:05:47Z","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/436571478","html_url":"https://github.com/aspnet/EntityFramework6/issues/382#issuecomment-436571478","issue_url":"https://api.github.com/repos/aspnet/EntityFramework6/issues/382","id":436571478,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNjU3MTQ3OA==","user":{"login":"vlm---","id":8326990,"node_id":"MDQ6VXNlcjgzMjY5OTA=","avatar_url":"https://avatars3.githubusercontent.com/u/8326990?v=4","gravatar_id":"","url":"https://api.github.com/users/vlm---","html_url":"https://github.com/vlm---","followers_url":"https://api.github.com/users/vlm---/followers","following_url":"https://api.github.com/users/vlm---/following{/other_user}","gists_url":"https://api.github.com/users/vlm---/gists{/gist_id}","starred_url":"https://api.github.com/users/vlm---/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vlm---/subscriptions","organizations_url":"https://api.github.com/users/vlm---/orgs","repos_url":"https://api.github.com/users/vlm---/repos","events_url":"https://api.github.com/users/vlm---/events{/privacy}","received_events_url":"https://api.github.com/users/vlm---/received_events","type":"User","site_admin":false},"created_at":"2018-11-07T10:05:47Z","updated_at":"2018-11-07T10:05:47Z","author_association":"NONE","body":"This issue started for us after we migrated our projects to PackageReference. In other solution where we have some projects with EF not yet migrated to PackageReference it somehow works, error is still displayed at the end but all EF commands do their job. Unfortunately I can't post any logs from this environment."}}
{"actor":{"display_login":"vlm---"}}