Port CLI tools to be dotnet global tools

- Rename package IDs to dotnet-watch, dotnet-user-secrets, and dotnet-sql-cache
- Change packaging layout to support dotnet-install-tool
- Change package metadata to DotnetTool
- Drop support for DotNetCliToolReference (those will continue to be available under previous package ID's)
- Rename project files and folders
This commit is contained in:
Nate McMaster 2017-12-29 08:41:21 -08:00
parent d81f23e159
commit 261b27b700
118 changed files with 401 additions and 211 deletions

1
.gitignore vendored
View File

@ -35,3 +35,4 @@ testWorkDir/
.idea/
.dotnet/
global.json
*.binlog

View File

@ -7,7 +7,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{66517987-2A5
src\Directory.Build.props = src\Directory.Build.props
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Watcher.Tools", "src\Microsoft.DotNet.Watcher.Tools\Microsoft.DotNet.Watcher.Tools.csproj", "{8A8CEABC-AC47-43FF-A5DF-69224F7E1F46}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-watch", "src\dotnet-watch\dotnet-watch.csproj", "{8A8CEABC-AC47-43FF-A5DF-69224F7E1F46}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8321E0D1-9A47-4D2F-AED8-3AE636D44E35}"
ProjectSection(SolutionItems) = preProject
@ -36,17 +36,17 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{F5B382BC-2
test\Directory.Build.props = test\Directory.Build.props
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Watcher.Tools.FunctionalTests", "test\Microsoft.DotNet.Watcher.Tools.FunctionalTests\Microsoft.DotNet.Watcher.Tools.FunctionalTests.csproj", "{16BADE2F-1184-4518-8A70-B68A19D0805B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-watch.FunctionalTests", "test\dotnet-watch.FunctionalTests\dotnet-watch.FunctionalTests.csproj", "{16BADE2F-1184-4518-8A70-B68A19D0805B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.SecretManager.Tools", "src\Microsoft.Extensions.SecretManager.Tools\Microsoft.Extensions.SecretManager.Tools.csproj", "{8730E848-CA0F-4E0A-9A2F-BC22AD0B2C4E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-user-secrets", "src\dotnet-user-secrets\dotnet-user-secrets.csproj", "{8730E848-CA0F-4E0A-9A2F-BC22AD0B2C4E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.SecretManager.Tools.Tests", "test\Microsoft.Extensions.SecretManager.Tools.Tests\Microsoft.Extensions.SecretManager.Tools.Tests.csproj", "{7B331122-83B1-4F08-A119-DC846959844C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-user-secrets.Tests", "test\dotnet-user-secrets.Tests\dotnet-user-secrets.Tests.csproj", "{7B331122-83B1-4F08-A119-DC846959844C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Watcher.Tools.Tests", "test\Microsoft.DotNet.Watcher.Tools.Tests\Microsoft.DotNet.Watcher.Tools.Tests.csproj", "{8A2E6961-6B12-4A8E-8215-3E7301D52EAC}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-watch.Tests", "test\dotnet-watch.Tests\dotnet-watch.Tests.csproj", "{8A2E6961-6B12-4A8E-8215-3E7301D52EAC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Caching.SqlConfig.Tools", "src\Microsoft.Extensions.Caching.SqlConfig.Tools\Microsoft.Extensions.Caching.SqlConfig.Tools.csproj", "{53F3B53D-303A-4DAA-9C38-4F55195FA5B9}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-sql-cache", "src\dotnet-sql-cache\dotnet-sql-cache.csproj", "{53F3B53D-303A-4DAA-9C38-4F55195FA5B9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.DeveloperCertificates.Tools", "src\Microsoft.AspNetCore.DeveloperCertificates.Tools\Microsoft.AspNetCore.DeveloperCertificates.Tools.csproj", "{4FED5119-EE5C-4753-88A4-D61BDEB4D6C8}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-dev-certs", "src\dotnet-dev-certs\dotnet-dev-certs.csproj", "{4FED5119-EE5C-4753-88A4-D61BDEB4D6C8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.VisualStudio.SecretManager", "tooling\Microsoft.VisualStudio.SecretManager\Microsoft.VisualStudio.SecretManager.csproj", "{5E117F2E-7152-447F-BF47-59F759EEF3A7}"
EndProject

View File

@ -4,24 +4,55 @@
"AdxVerificationCompositeRule"
],
"packages": {
"Microsoft.DotNet.Watcher.Tools": {
"dotnet-watch": {
"packageTypes": [
"DotnetCliTool"
"DotnetTool"
]
},
"Microsoft.Extensions.Caching.SqlConfig.Tools": {
"dotnet-sql-cache": {
"packageTypes": [
"DotnetCliTool"
]
"DotnetTool"
],
"Exclusions": {
"WRONG_PUBLICKEYTOKEN": {
"tools/netcoreapp2.1/any/System.Data.SqlClient.dll": "Assembly is built by another project but bundled in our nupkg.",
"tools/netcoreapp2.1/any/System.Text.Encoding.CodePages.dll": "Assembly is built by another project but bundled in our nupkg.",
"tools/netcoreapp2.1/any/runtimes/unix/lib/netstandard2.0/System.Data.SqlClient.dll": "Assembly is built by another project but bundled in our nupkg.",
"tools/netcoreapp2.1/any/runtimes/win/lib/netcoreapp2.0/System.Text.Encoding.CodePages.dll": "Assembly is built by another project but bundled in our nupkg.",
"tools/netcoreapp2.1/any/runtimes/win/lib/netstandard2.0/System.Data.SqlClient.dll": "Assembly is built by another project but bundled in our nupkg."
},
"ASSEMBLY_INFORMATIONAL_VERSION_MISMATCH": {
"tools/netcoreapp2.1/any/System.Data.SqlClient.dll": "Assembly is built by another project but bundled in our nupkg."
}
}
},
"Microsoft.Extensions.SecretManager.Tools": {
"dotnet-user-secrets": {
"packageTypes": [
"DotnetCliTool"
]
"DotnetTool"
],
"Exclusions": {
"NEUTRAL_RESOURCES_LANGUAGE": {
"tools/netcoreapp2.1/any/Newtonsoft.Json.dll": "Assembly is built by another project but bundled in our nupkg.",
"tools/netcoreapp2.1/any/System.Runtime.CompilerServices.Unsafe.dll": "Assembly is built by another project but bundled in our nupkg."
},
"SERVICING_ATTRIBUTE": {
"tools/netcoreapp2.1/any/Newtonsoft.Json.dll": "Assembly is built by another project but bundled in our nupkg."
},
"VERSION_INFORMATIONALVERSION": {
"tools/netcoreapp2.1/any/Newtonsoft.Json.dll": "Assembly is built by another project but bundled in our nupkg."
},
"WRONG_PUBLICKEYTOKEN": {
"tools/netcoreapp2.1/any/Newtonsoft.Json.dll": "Assembly is built by another project but bundled in our nupkg.",
"tools/netcoreapp2.1/any/System.Runtime.CompilerServices.Unsafe.dll": "Assembly is built by another project but bundled in our nupkg."
},
"ASSEMBLY_INFORMATIONAL_VERSION_MISMATCH": {
"tools/netcoreapp2.1/any/Newtonsoft.Json.dll": "Assembly is built by another project but bundled in our nupkg."
}
}
},
"Microsoft.AspNetCore.DeveloperCertificates.Tools": {
"dotnet-dev-certs": {
"packageTypes": [
"DotnetCliTool"
"DotnetTool"
]
},
"Microsoft.AspNetCore.DeveloperCertificates.XPlat": {

View File

@ -10,33 +10,36 @@ This project is part of ASP.NET Core. You can find samples, documentation and ge
The repository contains command-line tools for the .NET Core CLI. Follow the links below for more details on each tool.
- [dotnet-watch](src/Microsoft.DotNet.Watcher.Tools/) (Microsoft.DotNet.Watcher.Tools)
- [dotnet-user-secrets](src/Microsoft.Extensions.SecretManager.Tools/) (Microsoft.Extensions.SecretManager.Tools)
- [dotnet-sql-cache](src/Microsoft.Extensions.Caching.SqlConfig.Tools/) (Microsoft.Extensions.Caching.SqlConfig.Tools)
- [dotnet-watch](src/dotnet-watch/)
- [dotnet-user-secrets](src/dotnet-user-secrets/)
- [dotnet-sql-cache](src/dotnet-sql-cache/) (dotnet-sql-cache)
- [dotnet-dev-certs](src/dotnet-dev-certs/) (dotnet-dev-certs)
## How to Install
Install tools by editing your \*.csproj file and adding a `DotNetCliToolReference` with the package name and version.
Install tools using the .NET Core command-line.
```
dotnet install tool dotnet-watch
dotnet install tool dotnet-user-secrets
dotnet install tool dotnet-dev-certs
dotnet install tool dotnet-sql-cache
```xml
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="2.0.0" />
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0" />
<DotNetCliToolReference Include="Microsoft.Extensions.Caching.SqlConfig.Tools" Version="2.0.0" />
</ItemGroup>
```
Then, from command line, change directories to your project and run the following commands:
## Usage
The command line tools can be invoked as a new verb hanging off `dotnet`.
```sh
# Location of MyProject.csproj which includes DotNetCliToolReference's
cd C:\Source\MyProject\
# Download tools into the project
dotnet restore
# Execute tools
dotnet watch
dotnet user-secrets
dotnet sql-cache
dotnet dev-certs
```
Add `--help` to see more details. For example,
```
dotnet watch --help
```

View File

@ -1,4 +1,4 @@
<Project>
<Project>
<PropertyGroup>
<BuildVSIX Condition="'$(BuildVSIX)' ==''">true</BuildVSIX>
<RestoreDependsOn Condition="'$(OS)'=='Windows_NT' AND '$(BuildVSIX)' == 'true'">$(RestoreDependsOn);RestoreVSIX</RestoreDependsOn>
@ -32,7 +32,7 @@
<PackageId>$(VSIXName)</PackageId>
</ArtifactInfo>
<FilesToSign Include="$(VSIXOutputPath)" Certificate="Vsix" />
<FilesToSign Include="$(VSIXOutputPath)" Certificate="Vsix" IsContainer="true" />
<FilesToExcludeFromSigning Include="$(VSIXManifestOutputPath)" />
</ItemGroup>
</Target>

View File

@ -4,8 +4,6 @@
</PropertyGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="2.0.0" />
<Watch Include="say-hello.js" />
</ItemGroup>

View File

@ -11,7 +11,6 @@ Launch any command with dotnet-watch
Open a terminal to the directory containing this project.
```
dotnet restore
dotnet watch msbuild /t:RunMyNpmCommand
```

View File

@ -2,4 +2,4 @@ dotnet-watch samples
====================
The samples in this folder show some ways to customize dotnet-watch. For full details on
available settings and configuration, see the [README for the Microsoft.DotNet.Watcher.Tools](../../src/Microsoft.DotNet.Watcher.Tools/README.md) project.
available settings and configuration, see the [README for the dotnet-watch](../../src/dotnet-watch/README.md) project.

View File

@ -10,7 +10,6 @@ Install .NET Core command line. <https://dot.net/core>
Open a terminal to the directory containing this project.
```
dotnet restore
dotnet watch run
```

View File

@ -11,7 +11,6 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
<DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="2.0.0" />
</ItemGroup>
</Project>

View File

@ -10,8 +10,7 @@ Install .NET Core command line. <https://dot.net/core>
Open a terminal to the directory containing this project.
```
dotnet restore watch.proj
dotnet watch msbuild watch.proj /t:TestAndRun
dotnet watch msbuild /t:TestAndRun
```
The "TestAndRun" target in watch.proj will execute "dotnet test" on Test.csproj and then launch the website by calling "dotnet run" on Web.csproj.

View File

@ -5,8 +5,6 @@
</PropertyGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="2.0.0" />
<ProjectReference Include="Web\Web.csproj" />
<ProjectReference Include="Test\Test.csproj" />
</ItemGroup>

View File

@ -1,6 +1,15 @@
<Project>
<Import Project="..\Directory.Build.props" />
<ItemDefinitionGroup>
<ExcludePackageFileFromSigning>
<Visible>false</Visible>
</ExcludePackageFileFromSigning>
<SignedPackageFile>
<Visible>false</Visible>
</SignedPackageFile>
</ItemDefinitionGroup>
<ItemGroup>
<PackageReference Include="Internal.AspNetCore.Sdk" PrivateAssets="All" Version="$(InternalAspNetCoreSdkPackageVersion)" />
</ItemGroup>

View File

@ -0,0 +1,6 @@
<Project>
<Import Project="DotnetTool.props" Condition="'$(PackageType)' == 'DotnetTool'" />
<Import Project="..\Directory.Build.targets" />
<Import Project="PackGlobalTool.targets" />
</Project>

16
src/DotnetTool.props Normal file
View File

@ -0,0 +1,16 @@
<Project>
<PropertyGroup>
<NuspecFile>$(MSBuildProjectDirectory)\$(MSBuildProjectName).nuspec</NuspecFile>
<NuspecFile Condition=" ! Exists($(NuspecFile))" />
<Serviceable Condition=" '$(Serviceable)' == '' ">true</Serviceable>
<PackageArtifactCategory>ship</PackageArtifactCategory>
<AssemblySigningCertName>Microsoft</AssemblySigningCertName>
<IncludeSymbols>false</IncludeSymbols>
<IncludeSource>false</IncludeSource>
</PropertyGroup>
<ItemGroup>
<SignedPackageFile Include="$(TargetPath)" PackagePath="tools/$(TargetFramework)/any/$(TargetFileName)" Certificate="$(AssemblySigningCertName)" />
</ItemGroup>
</Project>

View File

@ -5,6 +5,9 @@
<Description>Package for the CLI first run experience.</Description>
<DefineConstants>$(DefineConstants);XPLAT</DefineConstants>
<PackageTags>aspnet;cli</PackageTags>
<PackageArtifactCategory>shipoob</PackageArtifactCategory>
<AssemblySigningCertName>Microsoft</AssemblySigningCertName>
</PropertyGroup>
<ItemGroup>

View File

@ -1,23 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AssemblyName>dotnet-sql-cache</AssemblyName>
<OutputType>exe</OutputType>
<Description>Command line tool to create tables and indexes in a Microsoft SQL Server database for distributed caching.</Description>
<PackageId>Microsoft.Extensions.Caching.SqlConfig.Tools</PackageId>
<PackageTags>cache;distributedcache;sqlserver</PackageTags>
<PackageType>DotnetCliTool</PackageType>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\shared\**\*.cs" />
<None Include="prefercliruntime" Pack="true" PackagePath="\prefercliruntime" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.CommandLineUtils.Sources" PrivateAssets="All" Version="$(MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion)" />
<PackageReference Include="System.Data.SqlClient" Version="$(SystemDataSqlClientPackageVersion)" />
</ItemGroup>
</Project>

View File

@ -1,25 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AssemblyName>dotnet-user-secrets</AssemblyName>
<OutputType>exe</OutputType>
<Description>Command line tool to manage user secrets for Microsoft.Extensions.Configuration.</Description>
<PackageId>Microsoft.Extensions.SecretManager.Tools</PackageId>
<PackageTags>configuration;secrets;usersecrets</PackageTags>
<PackageType>DotnetCliTool</PackageType>
<GenerateUserSecretsAttribute>false</GenerateUserSecretsAttribute>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\shared\**\*.cs" />
<Content Include="toolassets\SecretManager.targets" CopyToOutputDirectory="PreserveNewest" PackagePath="%(Identity)" />
<Content Include="prefercliruntime" PackagePath="\prefercliruntime" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.CommandLineUtils.Sources" PrivateAssets="All" Version="$(MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="$(MicrosoftExtensionsConfigurationUserSecretsPackageVersion)" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
<Project>
<Target Name="PackGlobalTool" Condition="'$(PackageType)' == 'DotnetTool'" BeforeTargets="GenerateNuspec" DependsOnTargets="Publish">
<PropertyGroup>
<NuspecProperties>
publishDir=$(PublishDir);
version=$(PackageVersion);
licenseUrl=$(PackageLicenseUrl);
projectUrl=$(PackageProjectUrl);
iconUrl=$(PackageIconUrl);
serviceable=$(Serviceable);
copyright=$(Copyright);
description=$(Description);
repositoryUrl=$(RepositoryUrl);
targetframework=$(TargetFramework);
</NuspecProperties>
</PropertyGroup>
</Target>
</Project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<DotNetCliTool>
<Commands>
<Command Name="dotnet-dev-certs" EntryPoint="dotnet-dev-certs.dll" Runner="dotnet" />
</Commands>
</DotNetCliTool>

View File

@ -12,7 +12,7 @@ using Microsoft.Extensions.Tools.Internal;
namespace Microsoft.AspNetCore.DeveloperCertificates.Tools
{
class Program
internal class Program
{
private const int CriticalError = -1;
private const int Success = 0;
@ -32,7 +32,7 @@ namespace Microsoft.AspNetCore.DeveloperCertificates.Tools
{
var app = new CommandLineApplication
{
Name = "dotnet-developercertificates"
Name = "dotnet-dev-certs"
};
app.Command("https", c =>

View File

@ -2,12 +2,10 @@
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AssemblyName>dotnet-dev-certs</AssemblyName>
<OutputType>exe</OutputType>
<Description>Command line tool to generate certificates used in ASP.NET Core during development.</Description>
<PackageId>Microsoft.AspNetCore.DeveloperCertificates.Tools</PackageId>
<PackageTags>dotnet;developercertificates</PackageTags>
<PackageType>DotnetCliTool</PackageType>
<PackageType>DotnetTool</PackageType>
<RootNamespace>Microsoft.AspNetCore.DeveloperCertificates.Tools</RootNamespace>
</PropertyGroup>
<ItemGroup>
@ -22,10 +20,6 @@
<Compile Include="..\..\shared\PhysicalConsole.cs" Link="PhysicalConsole.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="prefercliruntime" PackagePath="\prefercliruntime" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Certificates.Generation.Sources" PrivateAssets="All" Version="$(MicrosoftAspNetCoreCertificatesGenerationSourcesPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.CommandLineUtils.Sources" PrivateAssets="All" Version="$(MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion)" />

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>dotnet-dev-certs</id>
<tags>dotnet developercertificates</tags>
<version>$version$</version>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<licenseUrl>$licenseUrl$</licenseUrl>
<projectUrl>$projectUrl$</projectUrl>
<iconUrl>$iconUrl$</iconUrl>
<description>$description$</description>
<copyright>$copyright$</copyright>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<serviceable>$serviceable$</serviceable>
<packageTypes>
<packageType name="DotnetTool" />
</packageTypes>
<repository type="git" url="$repositoryUrl$" />
<dependencies />
</metadata>
<files>
<file src="$publishdir$" target="tools/$targetframework$/any/" />
<file src="DotnetToolSettings.xml" target="tools/DotnetToolSettings.xml" />
</files>
</package>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<DotNetCliTool>
<Commands>
<Command Name="dotnet-sql-cache" EntryPoint="dotnet-sql-cache.dll" Runner="dotnet" />
</Commands>
</DotNetCliTool>

View File

@ -5,12 +5,10 @@ dotnet-sql-cache
### How To Install
Install `Microsoft.Extensions.Caching.SqlConfig.Tools` as a `DotNetCliToolReference` to your project.
From the command-line, execute:
```xml
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.Extensions.Caching.SqlConfig.Tools" Version="2.0.0" />
</ItemGroup>
```
dotnet install tool dotnet-sql-cache
```
### How To Use

View File

@ -8,7 +8,7 @@ namespace Microsoft.Extensions.Caching.SqlConfig.Tools
internal class SqlQueries
{
private const string CreateTableFormat = "CREATE TABLE {0}(" +
// Maximum size of primary key column is 900 bytes (898 bytes from key + 2 additional bytes used by the
// Maximum size of primary key column is 900 bytes (898 bytes from key + 2 additional bytes used by the
// Sql Server). In the case where the key is greater than 898 bytes, then it gets truncated.
// - Add collation to the key column to make it case-sensitive
"Id nvarchar(449) COLLATE SQL_Latin1_General_CP1_CS_AS NOT NULL, " +

View File

@ -0,0 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<OutputType>exe</OutputType>
<Description>Command line tool to create tables and indexes in a Microsoft SQL Server database for distributed caching.</Description>
<PackageType>DotnetTool</PackageType>
<PackageBasePath>tools/$(TargetFramework)/any/</PackageBasePath>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\shared\**\*.cs" />
<!-- This should already be signed by the dotnet-core team -->
<ExcludePackageFileFromSigning Include="$(PublishDir)System.Data.SqlClient.dll" PackagePath="$(PackageBasePath)System.Data.SqlClient.dll" />
<ExcludePackageFileFromSigning Include="$(PublishDir)System.Text.Encoding.CodePages.dll" PackagePath="$(PackageBasePath)System.Text.Encoding.CodePages.dll" />
<ExcludePackageFileFromSigning Include="$(PublishDir)runtimes/win-arm64/native/sni.dll" PackagePath="$(PackageBasePath)runtimes/win-arm64/native/sni.dll" />
<ExcludePackageFileFromSigning Include="$(PublishDir)runtimes/win-x64/native/sni.dll" PackagePath="$(PackageBasePath)runtimes/win-x64/native/sni.dll" />
<ExcludePackageFileFromSigning Include="$(PublishDir)runtimes/win-x86/native/sni.dll" PackagePath="$(PackageBasePath)runtimes/win-x86/native/sni.dll" />
<ExcludePackageFileFromSigning Include="$(PublishDir)runtimes/unix/lib/netstandard2.0/System.Data.SqlClient.dll" PackagePath="$(PackageBasePath)runtimes/unix/lib/netstandard2.0/System.Data.SqlClient.dll" />
<ExcludePackageFileFromSigning Include="$(PublishDir)runtimes/win/lib/netcoreapp2.0/System.Text.Encoding.CodePages.dll" PackagePath="$(PackageBasePath)runtimes/win/lib/netcoreapp2.0/System.Text.Encoding.CodePages.dll" />
<ExcludePackageFileFromSigning Include="$(PublishDir)runtimes/win/lib/netstandard2.0/System.Data.SqlClient.dll" PackagePath="$(PackageBasePath)runtimes/win/lib/netstandard2.0/System.Data.SqlClient.dll" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.CommandLineUtils.Sources" PrivateAssets="All" Version="$(MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion)" />
<PackageReference Include="System.Data.SqlClient" Version="$(SystemDataSqlClientPackageVersion)" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>dotnet-sql-cache</id>
<tags>cache distributedcache sqlserver</tags>
<version>$version$</version>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<licenseUrl>$licenseUrl$</licenseUrl>
<projectUrl>$projectUrl$</projectUrl>
<iconUrl>$iconUrl$</iconUrl>
<description>$description$</description>
<copyright>$copyright$</copyright>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<serviceable>$serviceable$</serviceable>
<packageTypes>
<packageType name="DotnetTool" />
</packageTypes>
<repository type="git" url="$repositoryUrl$" />
<dependencies />
</metadata>
<files>
<file src="$publishdir$" target="tools/$targetframework$/any/" />
<file src="DotnetToolSettings.xml" target="tools/DotnetToolSettings.xml" />
</files>
</package>

View File

@ -33,15 +33,15 @@ namespace Microsoft.Extensions.SecretManager.Tools
var optionVerbose = app.VerboseOption();
var optionProject = app.Option("-p|--project <PROJECT>", "Path to project, default is current directory",
var optionProject = app.Option("-p|--project <PROJECT>", "Path to project. Defaults to searching the current directory.",
CommandOptionType.SingleValue, inherited: true);
var optionConfig = app.Option("-c|--configuration <CONFIGURATION>", $"The project configuration to use. Defaults to 'Debug'",
var optionConfig = app.Option("-c|--configuration <CONFIGURATION>", $"The project configuration to use. Defaults to 'Debug'.",
CommandOptionType.SingleValue, inherited: true);
// the escape hatch if project evaluation fails, or if users want to alter a secret store other than the one
// in the current project
var optionId = app.Option("--id", "The user secret id to use.",
var optionId = app.Option("--id", "The user secret ID to use.",
CommandOptionType.SingleValue, inherited: true);
var options = new CommandLineOptions();
@ -69,4 +69,4 @@ namespace Microsoft.Extensions.SecretManager.Tools
return options;
}
}
}
}

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<DotNetCliTool>
<Commands>
<Command Name="dotnet-user-secrets" EntryPoint="dotnet-user-secrets.dll" Runner="dotnet" />
</Commands>
</DotNetCliTool>

View File

@ -91,11 +91,10 @@ namespace Microsoft.Extensions.SecretManager.Tools.Internal
var assemblyDir = Path.GetDirectoryName(typeof(ProjectIdResolver).Assembly.Location);
var searchPaths = new[]
{
Path.Combine(AppContext.BaseDirectory, "assets"),
Path.Combine(assemblyDir, "assets"),
AppContext.BaseDirectory,
assemblyDir,
Path.Combine(assemblyDir, "../../toolassets"), // from nuget cache
Path.Combine(assemblyDir, "toolassets"), // from local build
Path.Combine(AppContext.BaseDirectory, "../../toolassets"), // relative to packaged deps.json
};
var targetPath = searchPaths.Select(p => Path.Combine(p, "SecretManager.targets")).FirstOrDefault(File.Exists);

View File

@ -5,12 +5,10 @@ dotnet-user-secrets
### How To Install
Install `Microsoft.Extensions.SecretManager.Tools` as a `DotNetCliToolReference` to your project.
From the command-line, execute:
```xml
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0" />
</ItemGroup>
```
dotnet install tool dotnet-user-secrets
```
### How To Use

View File

@ -0,0 +1,40 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<OutputType>exe</OutputType>
<Description>Command line tool to manage user secrets for Microsoft.Extensions.Configuration.</Description>
<PackageType>DotnetTool</PackageType>
<GenerateUserSecretsAttribute>false</GenerateUserSecretsAttribute>
<RootNamespace>Microsoft.Extensions.SecretManager.Tools</RootNamespace>
<PackageBasePath>tools/$(TargetFramework)/any/</PackageBasePath>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\shared\**\*.cs" />
<Content Include="assets\**\*" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
<!-- Files that come from other ASP.NET Core projects -->
<SignedPackageFile Include="$(PublishDir)Microsoft.Extensions.Configuration.Abstractions.dll" Certificate="$(AssemblySigningCertName)" PackagePath="$(PackageBasePath)Microsoft.Extensions.Configuration.Abstractions.dll" />
<SignedPackageFile Include="$(PublishDir)Microsoft.Extensions.Configuration.dll" Certificate="$(AssemblySigningCertName)" PackagePath="$(PackageBasePath)Microsoft.Extensions.Configuration.dll" />
<SignedPackageFile Include="$(PublishDir)Microsoft.Extensions.Configuration.FileExtensions.dll" Certificate="$(AssemblySigningCertName)" PackagePath="$(PackageBasePath)Microsoft.Extensions.Configuration.FileExtensions.dll" />
<SignedPackageFile Include="$(PublishDir)Microsoft.Extensions.Configuration.Json.dll" Certificate="$(AssemblySigningCertName)" PackagePath="$(PackageBasePath)Microsoft.Extensions.Configuration.Json.dll" />
<SignedPackageFile Include="$(PublishDir)Microsoft.Extensions.Configuration.UserSecrets.dll" Certificate="$(AssemblySigningCertName)" PackagePath="$(PackageBasePath)Microsoft.Extensions.Configuration.UserSecrets.dll" />
<SignedPackageFile Include="$(PublishDir)Microsoft.Extensions.FileProviders.Abstractions.dll" Certificate="$(AssemblySigningCertName)" PackagePath="$(PackageBasePath)Microsoft.Extensions.FileProviders.Abstractions.dll" />
<SignedPackageFile Include="$(PublishDir)Microsoft.Extensions.FileProviders.Physical.dll" Certificate="$(AssemblySigningCertName)" PackagePath="$(PackageBasePath)Microsoft.Extensions.FileProviders.Physical.dll" />
<SignedPackageFile Include="$(PublishDir)Microsoft.Extensions.FileSystemGlobbing.dll" Certificate="$(AssemblySigningCertName)" PackagePath="$(PackageBasePath)Microsoft.Extensions.FileSystemGlobbing.dll" />
<SignedPackageFile Include="$(PublishDir)Microsoft.Extensions.Primitives.dll" Certificate="$(AssemblySigningCertName)" PackagePath="$(PackageBasePath)Microsoft.Extensions.Primitives.dll" />
<!-- Third-party cert -->
<SignedPackageFile Include="$(PublishDir)Newtonsoft.Json.dll" Certificate="3PartyDual" PackagePath="$(PackageBasePath)Newtonsoft.Json.dll" />
<!-- This should already be signed by the dotnet-core team -->
<ExcludePackageFileFromSigning Include="$(PublishDir)System.Runtime.CompilerServices.Unsafe.dll" PackagePath="$(PackageBasePath)System.Runtime.CompilerServices.Unsafe.dll" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.CommandLineUtils.Sources" PrivateAssets="All" Version="$(MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="$(MicrosoftExtensionsConfigurationUserSecretsPackageVersion)" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>dotnet-user-secrets</id>
<tags>configuration secrets usersecrets</tags>
<version>$version$</version>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<licenseUrl>$licenseUrl$</licenseUrl>
<projectUrl>$projectUrl$</projectUrl>
<iconUrl>$iconUrl$</iconUrl>
<description>$description$</description>
<copyright>$copyright$</copyright>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<serviceable>$serviceable$</serviceable>
<packageTypes>
<packageType name="DotnetTool" />
</packageTypes>
<repository type="git" url="$repositoryUrl$" />
<dependencies />
</metadata>
<files>
<file src="$publishdir$" target="tools/$targetframework$/any/" />
<file src="DotnetToolSettings.xml" target="tools/DotnetToolSettings.xml" />
</files>
</package>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<DotNetCliTool>
<Commands>
<Command Name="dotnet-watch" EntryPoint="dotnet-watch.dll" Runner="dotnet" />
</Commands>
</DotNetCliTool>

View File

@ -12,8 +12,8 @@ namespace Microsoft.DotNet.Watcher.Internal
public static IFileSystemWatcher CreateWatcher(string watchedDirectory, bool usePollingWatcher)
{
return usePollingWatcher ?
new PollingFileWatcher(watchedDirectory) :
return usePollingWatcher ?
new PollingFileWatcher(watchedDirectory) :
new DotnetFileWatcher(watchedDirectory) as IFileSystemWatcher;
}
}

View File

@ -170,11 +170,10 @@ namespace Microsoft.DotNet.Watcher.Internal
var assemblyDir = Path.GetDirectoryName(typeof(MsBuildFileSetFactory).Assembly.Location);
var searchPaths = new[]
{
Path.Combine(AppContext.BaseDirectory, "assets"),
Path.Combine(assemblyDir, "assets"),
AppContext.BaseDirectory,
assemblyDir,
Path.Combine(assemblyDir, "../../toolassets"), // from nuget cache
Path.Combine(assemblyDir, "toolassets"), // from local build
Path.Combine(AppContext.BaseDirectory, "../../toolassets"), // relative to packaged deps.json
};
var targetPath = searchPaths.Select(p => Path.Combine(p, WatchTargetsFileName)).FirstOrDefault(File.Exists);

View File

@ -4,12 +4,10 @@ dotnet-watch
### How To Install
Install `Microsoft.DotNet.Watcher.Tools` as a `DotNetCliToolReference` to your project.
From the command-line, execute:
```xml
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="2.0.0" />
</ItemGroup>
```
dotnet install tool dotnet-watch
```
### How To Use

View File

@ -2,18 +2,15 @@
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AssemblyName>dotnet-watch</AssemblyName>
<OutputType>exe</OutputType>
<Description>Command line tool to watch for source file changes during development and restart the dotnet command.</Description>
<PackageId>Microsoft.DotNet.Watcher.Tools</PackageId>
<PackageTags>dotnet;watch</PackageTags>
<PackageType>DotnetCliTool</PackageType>
<PackageType>DotnetTool</PackageType>
<RootNamespace>Microsoft.DotNet.Watcher.Tools</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\shared\**\*.cs" />
<Content Include="prefercliruntime" PackagePath="\prefercliruntime" />
<Content Include="toolassets\DotNetWatch.targets" CopyToOutputDirectory="PreserveNewest" PackagePath="%(Identity)" />
<Content Include="assets\**\*" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>dotnet-watch</id>
<tags>dotnet watch</tags>
<version>$version$</version>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<licenseUrl>$licenseUrl$</licenseUrl>
<projectUrl>$projectUrl$</projectUrl>
<iconUrl>$iconUrl$</iconUrl>
<description>$description$</description>
<copyright>$copyright$</copyright>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<serviceable>$serviceable$</serviceable>
<packageTypes>
<packageType name="DotnetTool" />
</packageTypes>
<repository type="git" url="$repositoryUrl$" />
<dependencies />
</metadata>
<files>
<file src="$publishdir$" target="tools/$targetframework$/any/" />
<file src="DotnetToolSettings.xml" target="tools/DotnetToolSettings.xml" />
</files>
</package>

View File

@ -1,16 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Shared\**\*.cs" />
<Content Include="..\..\src\Microsoft.DotNet.Watcher.Tools\toolassets\DotNetWatch.targets" Link="toolassets\DotNetWatch.targets" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.DotNet.Watcher.Tools\Microsoft.DotNet.Watcher.Tools.csproj" />
</ItemGroup>
</Project>

View File

@ -1,16 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Shared\**\*.cs" />
<Content Include="..\..\src\Microsoft.Extensions.SecretManager.Tools\toolassets\SecretManager.targets" Link="toolassets\SecretManager.targets" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.Extensions.SecretManager.Tools\Microsoft.Extensions.SecretManager.Tools.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AssemblyName>Microsoft.Extensions.SecretManager.Tools.Tests</AssemblyName>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Shared\**\*.cs" />
<Content Include="..\..\src\dotnet-user-secrets\assets\SecretManager.targets" Link="assets\SecretManager.targets" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\dotnet-user-secrets\dotnet-user-secrets.csproj" />
</ItemGroup>
</Project>

View File

@ -39,6 +39,8 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests
public string WorkFolder { get; }
public string DotNetWatchPath { get; } = Path.Combine(AppContext.BaseDirectory, "tool", "dotnet-watch.dll");
public void AddTestProjectFolder(string projectName)
{
var srcFolder = Path.Combine(TestProjectSourceRoot, projectName);
@ -150,39 +152,6 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests
File.Copy(nugetConfigFilePath, tempNugetConfigFile);
}
public IEnumerable<string> GetDotnetWatchArguments()
{
// this launches a new .NET Core process using the runtime of the current test app
// and the version of dotnet-watch that this test app is compiled against
var thisAssembly = Path.GetFileNameWithoutExtension(GetType().GetTypeInfo().Assembly.Location);
var args = new List<string>
{
"exec",
"--depsfile",
Path.Combine(AppContext.BaseDirectory, thisAssembly + ".deps.json"),
"--runtimeconfig",
Path.Combine(AppContext.BaseDirectory, thisAssembly + ".runtimeconfig.json")
};
if (AppContext.GetData("FX_DEPS_FILE") is string currentFxVersion)
{
// This overrides the version of shared fx in the runtimeconfig.json file.
// Tests do this to ensure dotnet-watch is executing on the version of Microsoft.NETCore.App
// used by the current test project. The test project can target multiple version of
// netcoreapp1.x in order to ensure the tool runs when it is lifted to higher netcore versions
// due to inclusion of the 'prefercliruntime' file in our nupkg.
var version = new FileInfo(currentFxVersion).Directory.Name;
args.Add("--fx-version");
args.Add(version);
}
args.Add(Path.Combine(AppContext.BaseDirectory, "dotnet-watch.dll"));
return args;
}
private static string FindNugetConfig()
{
var currentDirPath = AppContext.BaseDirectory;
@ -216,4 +185,4 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests
}
}
}
}
}

View File

@ -69,9 +69,11 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests
throw new InvalidOperationException($"Call {nameof(PrepareAsync)} first");
}
var args = Scenario
.GetDotnetWatchArguments()
.Concat(arguments);
var args = new List<string>
{
Scenario.DotNetWatchPath,
};
args.AddRange(arguments);
var spec = new ProcessSpec
{

Some files were not shown because too many files have changed in this diff Show More