Skip to content

Commit

Permalink
Add documentation and comments to explain what Microsoft.DotNet.Globa…
Browse files Browse the repository at this point in the history
…lTools.Sdk is used for
  • Loading branch information
Nate McMaster committed May 1, 2018
1 parent bde5466 commit a1ff4a7
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/BundledPackages/BundledPackages.proj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
RemoveProperties="PublishDir" />

<PropertyGroup>
<!--
This is a workaround for https://github.com/Microsoft/msbuild/issues/2914.
Currently, the only way to configure the NuGetSdkResolver is with NuGet.config, which is not generally used in aspnet org projects.
This project is restored so that it pre-populates the NuGet cache with SDK packages.
-->
<BundledPackageRestorerContent>
<![CDATA[
<Project Sdk="Microsoft.NET.Sdk">
Expand Down
4 changes: 4 additions & 0 deletions modules/BundledPackages/module.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
<PrepareDependsOn>PreinstallBundledPackages;$(PrepareDependsOn)</PrepareDependsOn>
</PropertyGroup>

<!--
This is a workaround for https://github.com/Microsoft/msbuild/issues/2914.
This pre-populates the NuGet cache with bundled packages.
-->
<Target Name="PreinstallBundledPackages">
<MSBuild Targets="Restore"
Projects="$(MSBuildThisFileDirectory)BundledPackageRestorer.csproj"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<description>Provides additional support to .NET Core teams producing global CLI tools. This package is only intended for internal Microsoft use.</description>
<copyright>$copyright$</copyright>
<packageTypes>
<!-- This project needs to be MSBuildSdk because its targets need to influence the way /t:Restore works -->
<packageType name="MSBuildSdk" />
</packageTypes>
</metadata>
Expand Down
43 changes: 43 additions & 0 deletions src/Microsoft.DotNet.GlobalTools.Sdk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Microsoft.DotNet.GlobalTools.Sdk
================================

Provides additional support to .NET Core teams producing global CLI tools. This package is only intended for internal Microsoft use.

## Usage
Projects that need to bundle and sign the global CLI tool shim should add this to their .csproj file. This will include files in the .nupkg.

```xml
<!-- In MyTool.csproj -->
<Project>
<Sdk Name="Microsoft.NET.Sdk" />
<Sdk Name="Microsoft.DotNet.GlobalTools.Sdk" />

<PropertyGroup>
<PackAsTool>true</PackAsTool>
<GenerateToolShims>true</GenerateToolShims>
</PropertyGroup>
</Project>
```

```js
// in global.json
{
"msbuild-sdks": {
"Microsoft.DotNet.GlobalTools.Sdk": "2.1.0-rtm-12345"
}
}
```

### Additional options

#### `GenerateToolShims` (property)

A boolean flag. When `true`, tool shims will be generated for each RID listed in `GeneratedShimRuntimeIdentifiers` and included in the .nupkg.

Default value = `false`

#### `GeneratedShimRuntimeIdentifiers` (property)

A semi-colon separate list of RIDs for which to generate and pack the shim.

Default value = `win-x86;win-x64;osx-x64`

0 comments on commit a1ff4a7

Please sign in to comment.