{"action":"created","issue":{"url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/issues/2709","repository_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers","labels_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/issues/2709/labels{/name}","comments_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/issues/2709/comments","events_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/issues/2709/events","html_url":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/2709","id":328311714,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkxODg0NzEz","number":2709,"title":"Automatically include stylecop.json","user":{"login":"jeffkl","id":17556515,"node_id":"MDQ6VXNlcjE3NTU2NTE1","avatar_url":"https://avatars2.githubusercontent.com/u/17556515?v=4","gravatar_id":"","url":"https://api.github.com/users/jeffkl","html_url":"https://github.com/jeffkl","followers_url":"https://api.github.com/users/jeffkl/followers","following_url":"https://api.github.com/users/jeffkl/following{/other_user}","gists_url":"https://api.github.com/users/jeffkl/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffkl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffkl/subscriptions","organizations_url":"https://api.github.com/users/jeffkl/orgs","repos_url":"https://api.github.com/users/jeffkl/repos","events_url":"https://api.github.com/users/jeffkl/events{/privacy}","received_events_url":"https://api.github.com/users/jeffkl/received_events","type":"User","site_admin":false},"labels":[{"id":149019803,"node_id":"MDU6TGFiZWwxNDkwMTk4MDM=","url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/labels/in%20progress","name":"in progress","color":"bfe5bf","default":false}],"state":"open","locked":false,"assignee":{"login":"sharwell","id":1408396,"node_id":"MDQ6VXNlcjE0MDgzOTY=","avatar_url":"https://avatars1.githubusercontent.com/u/1408396?v=4","gravatar_id":"","url":"https://api.github.com/users/sharwell","html_url":"https://github.com/sharwell","followers_url":"https://api.github.com/users/sharwell/followers","following_url":"https://api.github.com/users/sharwell/following{/other_user}","gists_url":"https://api.github.com/users/sharwell/gists{/gist_id}","starred_url":"https://api.github.com/users/sharwell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharwell/subscriptions","organizations_url":"https://api.github.com/users/sharwell/orgs","repos_url":"https://api.github.com/users/sharwell/repos","events_url":"https://api.github.com/users/sharwell/events{/privacy}","received_events_url":"https://api.github.com/users/sharwell/received_events","type":"User","site_admin":false},"assignees":[{"login":"sharwell","id":1408396,"node_id":"MDQ6VXNlcjE0MDgzOTY=","avatar_url":"https://avatars1.githubusercontent.com/u/1408396?v=4","gravatar_id":"","url":"https://api.github.com/users/sharwell","html_url":"https://github.com/sharwell","followers_url":"https://api.github.com/users/sharwell/followers","following_url":"https://api.github.com/users/sharwell/following{/other_user}","gists_url":"https://api.github.com/users/sharwell/gists{/gist_id}","starred_url":"https://api.github.com/users/sharwell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharwell/subscriptions","organizations_url":"https://api.github.com/users/sharwell/orgs","repos_url":"https://api.github.com/users/sharwell/repos","events_url":"https://api.github.com/users/sharwell/events{/privacy}","received_events_url":"https://api.github.com/users/sharwell/received_events","type":"User","site_admin":false}],"milestone":null,"comments":6,"created_at":"2018-05-31T21:56:46Z","updated_at":"2018-06-13T16:15:07Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/pulls/2709","html_url":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/2709","diff_url":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/2709.diff","patch_url":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/2709.patch"},"body":"For legacy projects and older MSBuild, simply add the item as hidden and it will show up as a None item but still be passed as an AdditionalFiles item\r\n\r\nFor newer MSBuild, remove stylecop.json from None and add it to AdditionalFiles unless its already been done by the user.\r\n\r\nFixes #2698"},"comment":{"url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/issues/comments/396997298","html_url":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/2709#issuecomment-396997298","issue_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/issues/2709","id":396997298,"node_id":"MDEyOklzc3VlQ29tbWVudDM5Njk5NzI5OA==","user":{"login":"jeffkl","id":17556515,"node_id":"MDQ6VXNlcjE3NTU2NTE1","avatar_url":"https://avatars2.githubusercontent.com/u/17556515?v=4","gravatar_id":"","url":"https://api.github.com/users/jeffkl","html_url":"https://github.com/jeffkl","followers_url":"https://api.github.com/users/jeffkl/followers","following_url":"https://api.github.com/users/jeffkl/following{/other_user}","gists_url":"https://api.github.com/users/jeffkl/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffkl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffkl/subscriptions","organizations_url":"https://api.github.com/users/jeffkl/orgs","repos_url":"https://api.github.com/users/jeffkl/repos","events_url":"https://api.github.com/users/jeffkl/events{/privacy}","received_events_url":"https://api.github.com/users/jeffkl/received_events","type":"User","site_admin":false},"created_at":"2018-06-13T16:15:07Z","updated_at":"2018-06-13T16:15:07Z","author_association":"NONE","body":"Okay I might just close this PR.  There are a few complications:\r\n\r\n1. Legacy projects don't show linked files in Solution Explorer.  If you have something like this in an import:\r\n\r\n```xml\r\n<ItemGroup>\r\n  <AdditionalFiles Include=\"..\\..\\stylecop.json\">\r\n    <Link>stylecop.json</Link>\r\n  </AdditionalFiles>\r\n</ItemGroup>\r\n```\r\n\r\nIt doesn't show up in Solution Explorer.  It still gets passed to the compiler and the stylecop config is read but its really hard to tell in Visual Studio where the configuration is coming from unless you manually add `stylecop.json` as a Solution Item.  It feels like a bad user experience.\r\n\r\n2. New SDK-style projects don't need explicit items by default.  The auto-fix logic in StyleCop place an item directly in the project:\r\n\r\n```xml\r\n<ItemGroup>\r\n  <None Include=\"stylecop.json\" />\r\n</ItemGroup>\r\n```\r\n\r\nBut out-of-the-box SDK-style projects [include most files](https://github.com/dotnet/sdk/blob/master/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.props#L30) in `None` items unless you've set `EnableDefaultItems` to `false`.  I ran the fix logic under the debugger to try and come up with a way to make it work but the Roslyn Workspace object just doesn't have enough flexibility to read evaluated MSBuild properties or to add the file to disk but not add an item to the project.\r\n\r\nSo for SDK-style projects you end up with an item in the project and the import removes it and adds back one from a parent directory and again, it feels like a bad user experience. \r\n\r\nThere does not appear to be a way to tell from a RoslynWorkspace if the project is legacy or SDK-style so its hard to have more advanced logic.  Perhaps you know if there is a way to get MSBuild properties?  Or to not add an explicit item to the project and just create the file?"}}
{"actor":{"display_login":"jeffkl"}}