{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/sdk/pulls/comments/188485048","pull_request_review_id":120472241,"id":188485048,"diff_hunk":"@@ -0,0 +1,173 @@\n+﻿// Copyright (c) .NET Foundation and contributors. All rights reserved.\n+// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n+\n+using System.Collections.Generic;\n+using System.IO;\n+using System.Linq;\n+using Microsoft.Build.Framework;\n+using Microsoft.Build.Utilities;\n+using NuGet.Frameworks;\n+using NuGet.ProjectModel;\n+\n+namespace Microsoft.NET.Build.Tasks\n+{\n+    public sealed class GenerateShims : TaskBase\n+    {\n+        private NuGetPackageResolver _packageResolver;\n+\n+        /// <summary>\n+        /// Path to assets.json.\n+        /// </summary>\n+        public string ProjectAssetsFile { get; set; }\n+\n+        /// <summary>\n+        /// The file name of Apphost asset.\n+        /// </summary>\n+        [Required]\n+        public string DotNetAppHostExecutableNameWithoutExtension { get; set; }\n+\n+        /// <summary>\n+        /// Path to project file (.csproj|.vbproj|.fsproj)\n+        /// </summary>\n+        [Required]\n+        public string ProjectPath { get; set; }\n+\n+        /// <summary>\n+        /// TFM to use for compile-time assets.\n+        /// </summary>\n+        [Required]\n+        public string TargetFrameworkMoniker { get; set; }\n+\n+        /// <summary>\n+        /// PackageId of the dotnet tool NuGet Package.\n+        /// </summary>\n+        [Required]\n+        public string PackageId { get; set; }\n+\n+        /// <summary>\n+        /// Package Version of the dotnet tool NuGet Package.\n+        /// </summary>\n+        [Required]\n+        public string PackageVersion { get; set; }\n+\n+        /// <summary>\n+        /// The command name of the dotnet tool.\n+        /// </summary>\n+        [Required]\n+        public string ToolCommandName { get; set; }\n+\n+        /// <summary>\n+        /// The entry point of the dotnet tool which will be run by Apphost\n+        /// </summary>\n+        [Required]\n+        public string ToolEntryPoint { get; set; }\n+\n+        /// <summary>\n+        /// The output Directroy path of generated shims.\n+        /// </summary>\n+        [Required]\n+        public string PackagedShimOutputDirectory { get; set; }\n+\n+        /// <summary>\n+        /// The RuntimeIdentifiers that shims will be generated for.\n+        /// </summary>\n+        [Required]\n+        public ITaskItem[] PackageToolShimRuntimeIdentifiers { get; set; }\n+\n+        /// <summary>\n+        /// Path of generated shims. metadata \"ShimRuntimeIdentifier\" is used to map back to PackageToolShimRuntimeIdentifiers.\n+        /// </summary>\n+        [Output]\n+        public ITaskItem[] EmbeddedApphostPaths { get; private set; }\n+\n+        protected override void ExecuteCore()\n+        {\n+            NuGetFramework targetFramework = NuGetUtils.ParseFrameworkName(TargetFrameworkMoniker);\n+            LockFile lockFile = new LockFileCache(this).GetLockFile(ProjectAssetsFile);\n+            _packageResolver = NuGetPackageResolver.CreateResolver(lockFile, ProjectPath);\n+\n+            var embeddedApphostPaths = new List<ITaskItem>();\n+            foreach (var runtimeIdentifier in PackageToolShimRuntimeIdentifiers.Select(r => r.ItemSpec))\n+            {\n+                var resolvedApphostAssetPath = GetApphostAsset(targetFramework, lockFile, runtimeIdentifier);\n+\n+                var packagedShimOutputDirectoryAndRid = Path.Combine(PackagedShimOutputDirectory, runtimeIdentifier);\n+                var appHostDestinationFilePath =\n+                    Path.Combine(packagedShimOutputDirectoryAndRid,\n+                        $\"{ToolCommandName}{Path.GetExtension(resolvedApphostAssetPath)}\");\n+                var appBinaryFilePath =\n+                    $\".store/{PackageId.ToLowerInvariant()}/{PackageVersion}/{PackageId.ToLowerInvariant()}/{PackageVersion}/tools/{targetFramework.GetShortFolderName()}/any/{ToolEntryPoint}\";","path":"src/Tasks/Microsoft.NET.Build.Tasks/GenerateShims.cs","position":null,"original_position":99,"commit_id":"4f50eb2016d57191da8c567178052f358b192654","original_commit_id":"f5714e1d70116b265efdaa890443016199d07882","user":{"login":"wli3","id":6993335,"avatar_url":"https://avatars1.githubusercontent.com/u/6993335?v=4","gravatar_id":"","url":"https://api.github.com/users/wli3","html_url":"https://github.com/wli3","followers_url":"https://api.github.com/users/wli3/followers","following_url":"https://api.github.com/users/wli3/following{/other_user}","gists_url":"https://api.github.com/users/wli3/gists{/gist_id}","starred_url":"https://api.github.com/users/wli3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wli3/subscriptions","organizations_url":"https://api.github.com/users/wli3/orgs","repos_url":"https://api.github.com/users/wli3/repos","events_url":"https://api.github.com/users/wli3/events{/privacy}","received_events_url":"https://api.github.com/users/wli3/received_events","type":"User","site_admin":false},"body":"changed as above","created_at":"2018-05-16T02:00:32Z","updated_at":"2018-05-16T02:00:32Z","html_url":"https://github.com/dotnet/sdk/pull/2239#discussion_r188485048","pull_request_url":"https://api.github.com/repos/dotnet/sdk/pulls/2239","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/dotnet/sdk/pulls/comments/188485048"},"html":{"href":"https://github.com/dotnet/sdk/pull/2239#discussion_r188485048"},"pull_request":{"href":"https://api.github.com/repos/dotnet/sdk/pulls/2239"}},"in_reply_to_id":188422035},"pull_request":{"url":"https://api.github.com/repos/dotnet/sdk/pulls/2239","id":187580560,"html_url":"https://github.com/dotnet/sdk/pull/2239","diff_url":"https://github.com/dotnet/sdk/pull/2239.diff","patch_url":"https://github.com/dotnet/sdk/pull/2239.patch","issue_url":"https://api.github.com/repos/dotnet/sdk/issues/2239","number":2239,"state":"open","locked":false,"title":"Generate shim with PackAsTool","user":{"login":"wli3","id":6993335,"avatar_url":"https://avatars1.githubusercontent.com/u/6993335?v=4","gravatar_id":"","url":"https://api.github.com/users/wli3","html_url":"https://github.com/wli3","followers_url":"https://api.github.com/users/wli3/followers","following_url":"https://api.github.com/users/wli3/following{/other_user}","gists_url":"https://api.github.com/users/wli3/gists{/gist_id}","starred_url":"https://api.github.com/users/wli3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wli3/subscriptions","organizations_url":"https://api.github.com/users/wli3/orgs","repos_url":"https://api.github.com/users/wli3/repos","events_url":"https://api.github.com/users/wli3/events{/privacy}","received_events_url":"https://api.github.com/users/wli3/received_events","type":"User","site_admin":false},"body":"Add PackageToolShimRuntimeIdentifiers property to the csproj. And the result nupkg will have shims which can be signed.","created_at":"2018-05-11T22:07:26Z","updated_at":"2018-05-16T02:00:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fb62c0347e437a416732d178a916c06499751eb0","assignee":null,"assignees":[],"requested_reviewers":[{"login":"dsplaisted","id":145043,"avatar_url":"https://avatars3.githubusercontent.com/u/145043?v=4","gravatar_id":"","url":"https://api.github.com/users/dsplaisted","html_url":"https://github.com/dsplaisted","followers_url":"https://api.github.com/users/dsplaisted/followers","following_url":"https://api.github.com/users/dsplaisted/following{/other_user}","gists_url":"https://api.github.com/users/dsplaisted/gists{/gist_id}","starred_url":"https://api.github.com/users/dsplaisted/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsplaisted/subscriptions","organizations_url":"https://api.github.com/users/dsplaisted/orgs","repos_url":"https://api.github.com/users/dsplaisted/repos","events_url":"https://api.github.com/users/dsplaisted/events{/privacy}","received_events_url":"https://api.github.com/users/dsplaisted/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/sdk/pulls/2239/commits","review_comments_url":"https://api.github.com/repos/dotnet/sdk/pulls/2239/comments","review_comment_url":"https://api.github.com/repos/dotnet/sdk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/sdk/issues/2239/comments","statuses_url":"https://api.github.com/repos/dotnet/sdk/statuses/4f50eb2016d57191da8c567178052f358b192654","head":{"label":"wli3:generate-shim-packastool-05","ref":"generate-shim-packastool-05","sha":"4f50eb2016d57191da8c567178052f358b192654","user":{"login":"wli3","id":6993335,"avatar_url":"https://avatars1.githubusercontent.com/u/6993335?v=4","gravatar_id":"","url":"https://api.github.com/users/wli3","html_url":"https://github.com/wli3","followers_url":"https://api.github.com/users/wli3/followers","following_url":"https://api.github.com/users/wli3/following{/other_user}","gists_url":"https://api.github.com/users/wli3/gists{/gist_id}","starred_url":"https://api.github.com/users/wli3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wli3/subscriptions","organizations_url":"https://api.github.com/users/wli3/orgs","repos_url":"https://api.github.com/users/wli3/repos","events_url":"https://api.github.com/users/wli3/events{/privacy}","received_events_url":"https://api.github.com/users/wli3/received_events","type":"User","site_admin":false},"repo":{"id":95827602,"name":"sdk","full_name":"wli3/sdk","owner":{"login":"wli3","id":6993335,"avatar_url":"https://avatars1.githubusercontent.com/u/6993335?v=4","gravatar_id":"","url":"https://api.github.com/users/wli3","html_url":"https://github.com/wli3","followers_url":"https://api.github.com/users/wli3/followers","following_url":"https://api.github.com/users/wli3/following{/other_user}","gists_url":"https://api.github.com/users/wli3/gists{/gist_id}","starred_url":"https://api.github.com/users/wli3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wli3/subscriptions","organizations_url":"https://api.github.com/users/wli3/orgs","repos_url":"https://api.github.com/users/wli3/repos","events_url":"https://api.github.com/users/wli3/events{/privacy}","received_events_url":"https://api.github.com/users/wli3/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wli3/sdk","description":"Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI","fork":true,"url":"https://api.github.com/repos/wli3/sdk","forks_url":"https://api.github.com/repos/wli3/sdk/forks","keys_url":"https://api.github.com/repos/wli3/sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wli3/sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wli3/sdk/teams","hooks_url":"https://api.github.com/repos/wli3/sdk/hooks","issue_events_url":"https://api.github.com/repos/wli3/sdk/issues/events{/number}","events_url":"https://api.github.com/repos/wli3/sdk/events","assignees_url":"https://api.github.com/repos/wli3/sdk/assignees{/user}","branches_url":"https://api.github.com/repos/wli3/sdk/branches{/branch}","tags_url":"https://api.github.com/repos/wli3/sdk/tags","blobs_url":"https://api.github.com/repos/wli3/sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wli3/sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wli3/sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/wli3/sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wli3/sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/wli3/sdk/languages","stargazers_url":"https://api.github.com/repos/wli3/sdk/stargazers","contributors_url":"https://api.github.com/repos/wli3/sdk/contributors","subscribers_url":"https://api.github.com/repos/wli3/sdk/subscribers","subscription_url":"https://api.github.com/repos/wli3/sdk/subscription","commits_url":"https://api.github.com/repos/wli3/sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/wli3/sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/wli3/sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/wli3/sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/wli3/sdk/contents/{+path}","compare_url":"https://api.github.com/repos/wli3/sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wli3/sdk/merges","archive_url":"https://api.github.com/repos/wli3/sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wli3/sdk/downloads","issues_url":"https://api.github.com/repos/wli3/sdk/issues{/number}","pulls_url":"https://api.github.com/repos/wli3/sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/wli3/sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/wli3/sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wli3/sdk/labels{/name}","releases_url":"https://api.github.com/repos/wli3/sdk/releases{/id}","deployments_url":"https://api.github.com/repos/wli3/sdk/deployments","created_at":"2017-06-29T23:08:22Z","updated_at":"2017-06-29T23:08:24Z","pushed_at":"2018-05-16T01:57:02Z","git_url":"git://github.com/wli3/sdk.git","ssh_url":"git@github.com:wli3/sdk.git","clone_url":"https://github.com/wli3/sdk.git","svn_url":"https://github.com/wli3/sdk","homepage":"https://dot.net/core","size":9795,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:release/2.1.4xx","ref":"release/2.1.4xx","sha":"ff614c6d69f50b9396cee9d19a808d0da09a9c3d","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","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":63984307,"name":"sdk","full_name":"dotnet/sdk","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","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/sdk","description":"Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI","fork":false,"url":"https://api.github.com/repos/dotnet/sdk","forks_url":"https://api.github.com/repos/dotnet/sdk/forks","keys_url":"https://api.github.com/repos/dotnet/sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/sdk/teams","hooks_url":"https://api.github.com/repos/dotnet/sdk/hooks","issue_events_url":"https://api.github.com/repos/dotnet/sdk/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/sdk/events","assignees_url":"https://api.github.com/repos/dotnet/sdk/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/sdk/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/sdk/tags","blobs_url":"https://api.github.com/repos/dotnet/sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/sdk/languages","stargazers_url":"https://api.github.com/repos/dotnet/sdk/stargazers","contributors_url":"https://api.github.com/repos/dotnet/sdk/contributors","subscribers_url":"https://api.github.com/repos/dotnet/sdk/subscribers","subscription_url":"https://api.github.com/repos/dotnet/sdk/subscription","commits_url":"https://api.github.com/repos/dotnet/sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/sdk/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/sdk/merges","archive_url":"https://api.github.com/repos/dotnet/sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/sdk/downloads","issues_url":"https://api.github.com/repos/dotnet/sdk/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/sdk/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/sdk/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/sdk/deployments","created_at":"2016-07-22T21:26:02Z","updated_at":"2018-05-15T21:56:02Z","pushed_at":"2018-05-16T01:57:03Z","git_url":"git://github.com/dotnet/sdk.git","ssh_url":"git@github.com:dotnet/sdk.git","clone_url":"https://github.com/dotnet/sdk.git","svn_url":"https://github.com/dotnet/sdk","homepage":"https://dot.net/core","size":4429,"stargazers_count":224,"watchers_count":224,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":123,"mirror_url":null,"archived":false,"open_issues_count":245,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":123,"open_issues":245,"watchers":224,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/sdk/pulls/2239"},"html":{"href":"https://github.com/dotnet/sdk/pull/2239"},"issue":{"href":"https://api.github.com/repos/dotnet/sdk/issues/2239"},"comments":{"href":"https://api.github.com/repos/dotnet/sdk/issues/2239/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/sdk/pulls/2239/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/sdk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/sdk/pulls/2239/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/sdk/statuses/4f50eb2016d57191da8c567178052f358b192654"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"wli3"}}