Skip to content

Commit

Permalink
Add cli tool support to .net proj files (#419)
Browse files Browse the repository at this point in the history
This expands the existing .net proj file linking to also support [cli references](https://docs.microsoft.com/en-us/dotnet/core/tools/extensibility) via `DotNetCliToolReference`.

An example of where this works is https://github.com/aspnet/DotNetTools/blob/3c20e7c45beb5d45547b549964a3da83b2e8303e/samples/dotnet-watch/LaunchAnyCommand/LaunchAnyCommand.csproj#L6-L10
  • Loading branch information
xt0rted authored and josephfrazier committed Dec 28, 2017
1 parent e02bfde commit 598feaf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/helper-grammar-regex-collection/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export const JAVA_IMPORT = regex`
`;

export const NET_PROJ_PACKAGE = regex`
<PackageReference
<(PackageReference|DotNetCliToolReference)
\s+
.*
Include=${captureQuotedWord}
Expand Down
13 changes: 13 additions & 0 deletions packages/helper-grammar-regex-collection/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,11 +441,24 @@ const fixtures = {
'<PackageReference Include="foo">\n<Version>2.0.0</Version>\n</PackageReference>',
['foo'],
],
['<DotNetCliToolReference Include="foo" Version="6.2.0" />', ['foo']],
[
'<DotNetCliToolReference Include="foo" Version="$(MicrosoftExtensionsCachingMemoryPackageVersion)" />',
['foo'],
],
['<DotNetCliToolReference Version="6.2.0" Include="foo" />', ['foo']],
[
'<DotNetCliToolReference Include="foo">\n<Version>2.0.0</Version>\n</DotNetCliToolReference>',
['foo'],
],
],
invalid: [
'<PackageReferences Include="EntityFramework" Version="6.2.0" />',
'<PackageReference Includes="EntityFramework" Version="6.2.0" />',
'< PackageReference Include="EntityFramework" Version="6.2.0" />',
'<DotNetCliToolReferences Include="Microsoft.DotNet.Xdt.Tools" Version="2.0.0" />',
'<DotNetCliToolReference Includes="Microsoft.DotNet.Xdt.Tools" Version="2.0.0" />',
'< DotNetCliToolReference Include="Microsoft.DotNet.Xdt.Tools" Version="2.0.0" />',
],
},
};
Expand Down

0 comments on commit 598feaf

Please sign in to comment.