{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/cli/pulls/comments/82042897","pull_request_review_id":2977982,"id":82042897,"diff_hunk":"@@ -41,18 +54,81 @@ public int Execute()\n \n             EnsureNotNull(sdkVersion, \"Null Sdk Version\");\n \n+            MigrationReport migrationReport = null;\n+\n             foreach (var project in projectsToMigrate)\n             {\n                 Console.WriteLine($\"Migrating project {project}..\");\n                 var projectDirectory = Path.GetDirectoryName(project);\n                 var outputDirectory = projectDirectory;\n                 var migrationSettings = new MigrationSettings(projectDirectory, outputDirectory, sdkVersion, msBuildTemplate, _xprojFilePath);\n-                new ProjectMigrator().Migrate(migrationSettings, _skipProjectReferences);\n+                var projectMigrationReport = new ProjectMigrator().Migrate(migrationSettings, _skipProjectReferences);\n+\n+                if (migrationReport == null)\n+                {\n+                    migrationReport = projectMigrationReport;\n+                }\n+                else\n+                {\n+                    migrationReport = migrationReport.MergeReport(projectMigrationReport);\n+                }\n             }\n \n+            WriteReport(migrationReport);\n+\n             return 0;\n         }\n \n+        private void WriteReport(MigrationReport migrationReport)\n+        {\n+            using (var outputTextWriter = GetReportOutputTextWriter())\n+            {\n+                outputTextWriter.Write(GetReportContent(migrationReport));\n+            }\n+        }\n+\n+        private string GetReportContent(MigrationReport migrationReport)\n+        {\n+            if (_reportFormatJson)\n+            {\n+                return Newtonsoft.Json.JsonConvert.SerializeObject(migrationReport);\n+            }\n+\n+            StringBuilder sb = new StringBuilder();\n+\n+            foreach (var projectMigrationReport in migrationReport.ProjectMigrationReports)\n+            {\n+                if (projectMigrationReport.Errors.Any())\n+                {\n+                    sb.AppendLine($\"Project {projectMigrationReport.ProjectName} migration failed ({projectMigrationReport.ProjectDirectory})\");\n+                    sb.AppendLine(string.Join(\"\\n\", projectMigrationReport.Errors.Select(e => e.GetFormattedErrorMessage())));\n+                    sb.AppendLine();\n+                }\n+                else\n+                {\n+                    sb.AppendLine($\"Project {projectMigrationReport.ProjectName} migration succeeded ({projectMigrationReport.ProjectDirectory})\");","path":"src/dotnet/commands/dotnet-migrate/MigrateCommand.cs","position":96,"original_position":96,"commit_id":"d52d899298c12435bbc4ed1a2b553657999e8db2","original_commit_id":"d52d899298c12435bbc4ed1a2b553657999e8db2","user":{"login":"brthor","id":14280892,"avatar_url":"https://avatars.githubusercontent.com/u/14280892?v=3","gravatar_id":"","url":"https://api.github.com/users/brthor","html_url":"https://github.com/brthor","followers_url":"https://api.github.com/users/brthor/followers","following_url":"https://api.github.com/users/brthor/following{/other_user}","gists_url":"https://api.github.com/users/brthor/gists{/gist_id}","starred_url":"https://api.github.com/users/brthor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brthor/subscriptions","organizations_url":"https://api.github.com/users/brthor/orgs","repos_url":"https://api.github.com/users/brthor/repos","events_url":"https://api.github.com/users/brthor/events{/privacy}","received_events_url":"https://api.github.com/users/brthor/received_events","type":"User","site_admin":false},"body":"Yeah, I'm going to make a change to always bring the report even if you specify a file and then that should be doable. The issue I ran into was with using the TextWriter rather than Console to write.","created_at":"2016-10-05T18:46:22Z","updated_at":"2016-10-05T18:46:22Z","html_url":"https://github.com/dotnet/cli/pull/4310#discussion_r82042897","pull_request_url":"https://api.github.com/repos/dotnet/cli/pulls/4310","_links":{"self":{"href":"https://api.github.com/repos/dotnet/cli/pulls/comments/82042897"},"html":{"href":"https://github.com/dotnet/cli/pull/4310#discussion_r82042897"},"pull_request":{"href":"https://api.github.com/repos/dotnet/cli/pulls/4310"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/cli/pulls/4310","id":87986954,"html_url":"https://github.com/dotnet/cli/pull/4310","diff_url":"https://github.com/dotnet/cli/pull/4310.diff","patch_url":"https://github.com/dotnet/cli/pull/4310.patch","issue_url":"https://api.github.com/repos/dotnet/cli/issues/4310","number":4310,"state":"open","locked":false,"title":"Migration Report","user":{"login":"brthor","id":14280892,"avatar_url":"https://avatars.githubusercontent.com/u/14280892?v=3","gravatar_id":"","url":"https://api.github.com/users/brthor","html_url":"https://github.com/brthor","followers_url":"https://api.github.com/users/brthor/followers","following_url":"https://api.github.com/users/brthor/following{/other_user}","gists_url":"https://api.github.com/users/brthor/gists{/gist_id}","starred_url":"https://api.github.com/users/brthor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brthor/subscriptions","organizations_url":"https://api.github.com/users/brthor/orgs","repos_url":"https://api.github.com/users/brthor/repos","events_url":"https://api.github.com/users/brthor/events{/privacy}","received_events_url":"https://api.github.com/users/brthor/received_events","type":"User","site_admin":false},"body":"@livarcocc @srivatsn @333fred \r\n\r\n/cc @eerhardt @Sridhar-MS @blackdwarf \r\n\r\nThe migration report including options for outputting to a file or stdout in a user friendly or json format.\r\n\r\nFixes: #4165 \r\n\r\nSuccessful Example:\r\n \r\n<img width=\"428\" alt=\"screen shot 2016-10-04 at 3 09 17 pm\" src=\"https://cloud.githubusercontent.com/assets/14280892/19094891/83618798-8a47-11e6-88e2-60166868df22.png\">\r\n\r\nFailure Example:\r\n\r\n![screen shot 2016-10-04 at 3 30 01 pm](https://cloud.githubusercontent.com/assets/14280892/19094903/9a8ba732-8a47-11e6-8171-0c08eaa37b0f.png)\r\n\r\n","created_at":"2016-10-04T22:32:08Z","updated_at":"2016-10-05T18:46:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b42c9df4041123ca93a838310c89d6cf667f5339","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/cli/pulls/4310/commits","review_comments_url":"https://api.github.com/repos/dotnet/cli/pulls/4310/comments","review_comment_url":"https://api.github.com/repos/dotnet/cli/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/cli/issues/4310/comments","statuses_url":"https://api.github.com/repos/dotnet/cli/statuses/d52d899298c12435bbc4ed1a2b553657999e8db2","head":{"label":"brthor:brthor/migrationreport","ref":"brthor/migrationreport","sha":"d52d899298c12435bbc4ed1a2b553657999e8db2","user":{"login":"brthor","id":14280892,"avatar_url":"https://avatars.githubusercontent.com/u/14280892?v=3","gravatar_id":"","url":"https://api.github.com/users/brthor","html_url":"https://github.com/brthor","followers_url":"https://api.github.com/users/brthor/followers","following_url":"https://api.github.com/users/brthor/following{/other_user}","gists_url":"https://api.github.com/users/brthor/gists{/gist_id}","starred_url":"https://api.github.com/users/brthor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brthor/subscriptions","organizations_url":"https://api.github.com/users/brthor/orgs","repos_url":"https://api.github.com/users/brthor/repos","events_url":"https://api.github.com/users/brthor/events{/privacy}","received_events_url":"https://api.github.com/users/brthor/received_events","type":"User","site_admin":false},"repo":{"id":46514660,"name":"cli","full_name":"brthor/cli","owner":{"login":"brthor","id":14280892,"avatar_url":"https://avatars.githubusercontent.com/u/14280892?v=3","gravatar_id":"","url":"https://api.github.com/users/brthor","html_url":"https://github.com/brthor","followers_url":"https://api.github.com/users/brthor/followers","following_url":"https://api.github.com/users/brthor/following{/other_user}","gists_url":"https://api.github.com/users/brthor/gists{/gist_id}","starred_url":"https://api.github.com/users/brthor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brthor/subscriptions","organizations_url":"https://api.github.com/users/brthor/orgs","repos_url":"https://api.github.com/users/brthor/repos","events_url":"https://api.github.com/users/brthor/events{/privacy}","received_events_url":"https://api.github.com/users/brthor/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/brthor/cli","description":"This repo contains the .NET Core command-line (CLI) tools, used for building .NET Core apps and libraries through your development flow (compiling, NuGet package management, running, testing, ...).","fork":true,"url":"https://api.github.com/repos/brthor/cli","forks_url":"https://api.github.com/repos/brthor/cli/forks","keys_url":"https://api.github.com/repos/brthor/cli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brthor/cli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brthor/cli/teams","hooks_url":"https://api.github.com/repos/brthor/cli/hooks","issue_events_url":"https://api.github.com/repos/brthor/cli/issues/events{/number}","events_url":"https://api.github.com/repos/brthor/cli/events","assignees_url":"https://api.github.com/repos/brthor/cli/assignees{/user}","branches_url":"https://api.github.com/repos/brthor/cli/branches{/branch}","tags_url":"https://api.github.com/repos/brthor/cli/tags","blobs_url":"https://api.github.com/repos/brthor/cli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brthor/cli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brthor/cli/git/refs{/sha}","trees_url":"https://api.github.com/repos/brthor/cli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brthor/cli/statuses/{sha}","languages_url":"https://api.github.com/repos/brthor/cli/languages","stargazers_url":"https://api.github.com/repos/brthor/cli/stargazers","contributors_url":"https://api.github.com/repos/brthor/cli/contributors","subscribers_url":"https://api.github.com/repos/brthor/cli/subscribers","subscription_url":"https://api.github.com/repos/brthor/cli/subscription","commits_url":"https://api.github.com/repos/brthor/cli/commits{/sha}","git_commits_url":"https://api.github.com/repos/brthor/cli/git/commits{/sha}","comments_url":"https://api.github.com/repos/brthor/cli/comments{/number}","issue_comment_url":"https://api.github.com/repos/brthor/cli/issues/comments{/number}","contents_url":"https://api.github.com/repos/brthor/cli/contents/{+path}","compare_url":"https://api.github.com/repos/brthor/cli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brthor/cli/merges","archive_url":"https://api.github.com/repos/brthor/cli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brthor/cli/downloads","issues_url":"https://api.github.com/repos/brthor/cli/issues{/number}","pulls_url":"https://api.github.com/repos/brthor/cli/pulls{/number}","milestones_url":"https://api.github.com/repos/brthor/cli/milestones{/number}","notifications_url":"https://api.github.com/repos/brthor/cli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brthor/cli/labels{/name}","releases_url":"https://api.github.com/repos/brthor/cli/releases{/id}","deployments_url":"https://api.github.com/repos/brthor/cli/deployments","created_at":"2015-11-19T19:17:23Z","updated_at":"2016-06-01T22:27:26Z","pushed_at":"2016-10-05T18:39:24Z","git_url":"git://github.com/brthor/cli.git","ssh_url":"git@github.com:brthor/cli.git","clone_url":"https://github.com/brthor/cli.git","svn_url":"https://github.com/brthor/cli","homepage":"http://dotnet.github.io/","size":104305,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:rel/1.0.0","ref":"rel/1.0.0","sha":"7632cd35022120fac42142e984217548fceb3fa8","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":43568107,"name":"cli","full_name":"dotnet/cli","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/cli","description":"This repo contains the .NET Core command-line (CLI) tools, used for building .NET Core apps and libraries through your development flow (compiling, NuGet package management, running, testing, ...).","fork":false,"url":"https://api.github.com/repos/dotnet/cli","forks_url":"https://api.github.com/repos/dotnet/cli/forks","keys_url":"https://api.github.com/repos/dotnet/cli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/cli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/cli/teams","hooks_url":"https://api.github.com/repos/dotnet/cli/hooks","issue_events_url":"https://api.github.com/repos/dotnet/cli/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/cli/events","assignees_url":"https://api.github.com/repos/dotnet/cli/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/cli/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/cli/tags","blobs_url":"https://api.github.com/repos/dotnet/cli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/cli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/cli/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/cli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/cli/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/cli/languages","stargazers_url":"https://api.github.com/repos/dotnet/cli/stargazers","contributors_url":"https://api.github.com/repos/dotnet/cli/contributors","subscribers_url":"https://api.github.com/repos/dotnet/cli/subscribers","subscription_url":"https://api.github.com/repos/dotnet/cli/subscription","commits_url":"https://api.github.com/repos/dotnet/cli/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/cli/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/cli/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/cli/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/cli/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/cli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/cli/merges","archive_url":"https://api.github.com/repos/dotnet/cli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/cli/downloads","issues_url":"https://api.github.com/repos/dotnet/cli/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/cli/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/cli/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/cli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/cli/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/cli/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/cli/deployments","created_at":"2015-10-02T18:03:15Z","updated_at":"2016-10-05T00:57:16Z","pushed_at":"2016-10-05T18:39:24Z","git_url":"git://github.com/dotnet/cli.git","ssh_url":"git@github.com:dotnet/cli.git","clone_url":"https://github.com/dotnet/cli.git","svn_url":"https://github.com/dotnet/cli","homepage":"https://docs.microsoft.com/dotnet/ ","size":120497,"stargazers_count":1459,"watchers_count":1459,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":375,"mirror_url":null,"open_issues_count":785,"forks":375,"open_issues":785,"watchers":1459,"default_branch":"rel/1.0.0"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/cli/pulls/4310"},"html":{"href":"https://github.com/dotnet/cli/pull/4310"},"issue":{"href":"https://api.github.com/repos/dotnet/cli/issues/4310"},"comments":{"href":"https://api.github.com/repos/dotnet/cli/issues/4310/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/cli/pulls/4310/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/cli/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/cli/pulls/4310/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/cli/statuses/d52d899298c12435bbc4ed1a2b553657999e8db2"}}}}
{"actor":{"display_login":"brthor"}}