{"action":"created","issue":{"url":"https://api.github.com/repos/techtalk/SpecFlow/issues/1180","repository_url":"https://api.github.com/repos/techtalk/SpecFlow","labels_url":"https://api.github.com/repos/techtalk/SpecFlow/issues/1180/labels{/name}","comments_url":"https://api.github.com/repos/techtalk/SpecFlow/issues/1180/comments","events_url":"https://api.github.com/repos/techtalk/SpecFlow/issues/1180/events","html_url":"https://github.com/techtalk/SpecFlow/issues/1180","id":333979250,"node_id":"MDU6SXNzdWUzMzM5NzkyNTA=","number":1180,"title":"Including generated files in the new csproj SDK format","user":{"login":"ghelyar","id":3225358,"node_id":"MDQ6VXNlcjMyMjUzNTg=","avatar_url":"https://avatars2.githubusercontent.com/u/3225358?v=4","gravatar_id":"","url":"https://api.github.com/users/ghelyar","html_url":"https://github.com/ghelyar","followers_url":"https://api.github.com/users/ghelyar/followers","following_url":"https://api.github.com/users/ghelyar/following{/other_user}","gists_url":"https://api.github.com/users/ghelyar/gists{/gist_id}","starred_url":"https://api.github.com/users/ghelyar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghelyar/subscriptions","organizations_url":"https://api.github.com/users/ghelyar/orgs","repos_url":"https://api.github.com/users/ghelyar/repos","events_url":"https://api.github.com/users/ghelyar/events{/privacy}","received_events_url":"https://api.github.com/users/ghelyar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-20T08:43:56Z","updated_at":"2018-06-20T08:53:48Z","closed_at":null,"author_association":"NONE","body":"In order to exclude `.feature.cs` files from source control and have them generated on the build, I had to jump through a couple of hoops and couldn't find them documented anywhere.\r\n\r\nThis was all the documentation I could find, but it doesn't quite work with the new csproj format:\r\nhttp://specflow.org/documentation/Generate-Tests-from-MsBuild/\r\n\r\nIncluding the `SpecFlow.Tools.MsBuild.Generation` worked well for generating the `feature.cs` files, but they were not compiled by msbuild on the same pass. It all built without any warnings or errors, but then when running the tests, 0 tests were found.\r\n\r\nThis was also a bit hard to spot because Visual Studio build would create the `.feature.cs` files, then test explorer \"Run All\" would compile those `.feature.cs` files, so it appeared to work if _both_ were pressed, and every time after the `.feature.cs` file already existed it also worked immediately, but on the build machine where the file did not exist and only a single build was run on the solution, it appeared to build correctly but then found no tests.\r\n\r\nI tried using the `AfterUpdateFeatureFilesInProject` target as described on that page, but it did not work. However, if I renamed it (renaming it was actually required) and added `AfterTargets=\"UpdateFeatureFilesInProject\"` it did work.\r\n\r\nIn the end this was\r\n```\r\n  <Target Name=\"IncludeGeneratedFeatureFiles\" AfterTargets=\"UpdateFeatureFilesInProject\">\r\n    <ItemGroup>\r\n      <Compile Include=\"@(SpecFlowGeneratedFiles)\" />\r\n    </ItemGroup>\r\n  </Target>\r\n```\r\n\r\nIt would be good if either `AfterUpdateFeatureFilesInProject` as described in the documentation just worked, or the documentation was updated to include something that does work in this project.\r\n\r\nOn a related note, I don't know if this should be documented somewhere, but as the new csproj format shows everything by default, hiding the generated files in the solution explorer while still building them can be achieved with:\r\n```\r\n  <ItemGroup>\r\n    <Compile Update=\"**/*.feature.cs\" Visible=\"false\" />\r\n  </ItemGroup>\r\n```"},"comment":{"url":"https://api.github.com/repos/techtalk/SpecFlow/issues/comments/398675085","html_url":"https://github.com/techtalk/SpecFlow/issues/1180#issuecomment-398675085","issue_url":"https://api.github.com/repos/techtalk/SpecFlow/issues/1180","id":398675085,"node_id":"MDEyOklzc3VlQ29tbWVudDM5ODY3NTA4NQ==","user":{"login":"SabotageAndi","id":859801,"node_id":"MDQ6VXNlcjg1OTgwMQ==","avatar_url":"https://avatars0.githubusercontent.com/u/859801?v=4","gravatar_id":"","url":"https://api.github.com/users/SabotageAndi","html_url":"https://github.com/SabotageAndi","followers_url":"https://api.github.com/users/SabotageAndi/followers","following_url":"https://api.github.com/users/SabotageAndi/following{/other_user}","gists_url":"https://api.github.com/users/SabotageAndi/gists{/gist_id}","starred_url":"https://api.github.com/users/SabotageAndi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SabotageAndi/subscriptions","organizations_url":"https://api.github.com/users/SabotageAndi/orgs","repos_url":"https://api.github.com/users/SabotageAndi/repos","events_url":"https://api.github.com/users/SabotageAndi/events{/privacy}","received_events_url":"https://api.github.com/users/SabotageAndi/received_events","type":"User","site_admin":false},"created_at":"2018-06-20T08:53:48Z","updated_at":"2018-06-20T08:53:48Z","author_association":"COLLABORATOR","body":"SpecFlow doesn't support the new project format that well currently. The same is with PackageReference.\r\n\"Fixing\" all these issues is part of the .NET Core support for SpecFlow (https://github.com/techtalk/SpecFlow/projects/2).\r\n\r\nThen we will also update all the documentation."}}
{"actor":{"display_login":"SabotageAndi"}}