{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/sdk/issues/1595","repository_url":"https://api.github.com/repos/dotnet/sdk","labels_url":"https://api.github.com/repos/dotnet/sdk/issues/1595/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/sdk/issues/1595/comments","events_url":"https://api.github.com/repos/dotnet/sdk/issues/1595/events","html_url":"https://github.com/dotnet/sdk/issues/1595","id":259053898,"number":1595,"title":"Regression: VS2017 / Package References in library projects do not generate binding redirects","user":{"login":"MichaelKetting","id":6972548,"avatar_url":"https://avatars2.githubusercontent.com/u/6972548?v=4","gravatar_id":"","url":"https://api.github.com/users/MichaelKetting","html_url":"https://github.com/MichaelKetting","followers_url":"https://api.github.com/users/MichaelKetting/followers","following_url":"https://api.github.com/users/MichaelKetting/following{/other_user}","gists_url":"https://api.github.com/users/MichaelKetting/gists{/gist_id}","starred_url":"https://api.github.com/users/MichaelKetting/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MichaelKetting/subscriptions","organizations_url":"https://api.github.com/users/MichaelKetting/orgs","repos_url":"https://api.github.com/users/MichaelKetting/repos","events_url":"https://api.github.com/users/MichaelKetting/events{/privacy}","received_events_url":"https://api.github.com/users/MichaelKetting/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2017-09-20T06:30:02Z","updated_at":"2017-09-20T13:59:43Z","closed_at":null,"author_association":"NONE","body":"This might be releated to https://github.com/dotnet/sdk/issues/1351 but since all the existing issues only reference EXE and/or WinEXE project types, it also feels like a different issue.\r\n\r\nIn VS2013 and VS2015, when I created a Class Library project and added NuGet dependencies, I would get binding redirects generated into the app.config file. \r\n\r\nIn VS2017, this behavior still works vor Full Framework Class Library projects using packages.config. However, when I create a .NET Standard Class Library project or switch to PackageReferences in the Full Framework Class Library, this does not work. It also doesn't help to set \r\n`<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>`.\r\n\r\nIt can be workarounded by setting     `<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>\r\n`in the project file.\r\n\r\nI assume the reason is in \r\nhttps://github.com/Microsoft/msbuild/blob/master/src/Tasks/Microsoft.Common.CurrentVersion.targets#L2109\r\n```\r\n  <Target Name=\"GenerateBindingRedirectsUpdateAppConfig\"\r\n    AfterTargets=\"GenerateBindingRedirects\"\r\n    Condition=\"'$(AutoGenerateBindingRedirects)' == 'true' and '$(GenerateBindingRedirectsOutputType)' == 'true' and Exists('$(_GenerateBindingRedirectsIntermediateAppConfig)')\">\r\n```\r\nand\r\nhttps://github.com/Microsoft/msbuild/blob/master/src/Tasks/Microsoft.Common.CurrentVersion.targets#L326\r\n`<GenerateBindingRedirectsOutputType Condition=\"'$(OutputType)'=='exe' or '$(OutputType)'=='winexe'\">true</GenerateBindingRedirectsOutputType>\r\n`\r\nIf GenerateBindingRedirectsOutputType would also check for type 'Library', it would work. Actually, why check at all?\r\n\r\nWhile there exists a workaround, for library authors this is a pretty major problem since the concept of semantically versioned NuGet packages breaks down if the tooling doesn't support binding redirects - it is common and intended to have mismatched dependency version numbers. In turn, this means it's not possible to run unit tests on your library without binding redirects.\r\n\r\nEdit: Sorry, I think I might have created a duplicate of this one here: https://github.com/Microsoft/msbuild/issues/1310\r\n\r\nEdit 2: Added documentation about both .NET Standard and Full Framework with Package References."},"comment":{"url":"https://api.github.com/repos/dotnet/sdk/issues/comments/330860450","html_url":"https://github.com/dotnet/sdk/issues/1595#issuecomment-330860450","issue_url":"https://api.github.com/repos/dotnet/sdk/issues/1595","id":330860450,"user":{"login":"MichaelKetting","id":6972548,"avatar_url":"https://avatars2.githubusercontent.com/u/6972548?v=4","gravatar_id":"","url":"https://api.github.com/users/MichaelKetting","html_url":"https://github.com/MichaelKetting","followers_url":"https://api.github.com/users/MichaelKetting/followers","following_url":"https://api.github.com/users/MichaelKetting/following{/other_user}","gists_url":"https://api.github.com/users/MichaelKetting/gists{/gist_id}","starred_url":"https://api.github.com/users/MichaelKetting/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MichaelKetting/subscriptions","organizations_url":"https://api.github.com/users/MichaelKetting/orgs","repos_url":"https://api.github.com/users/MichaelKetting/repos","events_url":"https://api.github.com/users/MichaelKetting/events{/privacy}","received_events_url":"https://api.github.com/users/MichaelKetting/received_events","type":"User","site_admin":false},"created_at":"2017-09-20T13:59:43Z","updated_at":"2017-09-20T13:59:43Z","author_association":"NONE","body":"Thanks. This means, if you are just using your own test runner with a classic library project that contains tests and uses package references, you're still stuck with adding the binding redirect property overrides. \r\n\r\nNot sure yet how this will scale out."}}
{"actor":{"display_login":"MichaelKetting"}}