diff --git a/src/GetDocumentInsider/AnsiConsole.cs b/src/GetDocumentInsider/AnsiConsole.cs
index 30397229aa..c3f514bde4 100644
--- a/src/GetDocumentInsider/AnsiConsole.cs
+++ b/src/GetDocumentInsider/AnsiConsole.cs
@@ -3,7 +3,7 @@
using System;
-namespace GetDocument
+namespace Microsoft.Extensions.ApiDescription.Client
{
internal class AnsiConsole
{
diff --git a/src/GetDocumentInsider/AnsiConstants.cs b/src/GetDocumentInsider/AnsiConstants.cs
index e529180983..48f9ca2410 100644
--- a/src/GetDocumentInsider/AnsiConstants.cs
+++ b/src/GetDocumentInsider/AnsiConstants.cs
@@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-namespace GetDocument
+namespace Microsoft.Extensions.ApiDescription.Client
{
internal static class AnsiConstants
{
diff --git a/src/GetDocumentInsider/AnsiTextWriter.cs b/src/GetDocumentInsider/AnsiTextWriter.cs
index c8393d4810..471d9cf124 100644
--- a/src/GetDocumentInsider/AnsiTextWriter.cs
+++ b/src/GetDocumentInsider/AnsiTextWriter.cs
@@ -6,7 +6,7 @@ using System.Diagnostics;
using System.IO;
using System.Text.RegularExpressions;
-namespace GetDocument
+namespace Microsoft.Extensions.ApiDescription.Client
{
internal class AnsiTextWriter
{
diff --git a/src/GetDocumentInsider/CommandException.cs b/src/GetDocumentInsider/CommandException.cs
index 5d9778e61f..18680f9593 100644
--- a/src/GetDocumentInsider/CommandException.cs
+++ b/src/GetDocumentInsider/CommandException.cs
@@ -3,7 +3,7 @@
using System;
-namespace GetDocument
+namespace Microsoft.Extensions.ApiDescription.Client
{
internal class CommandException : Exception
{
diff --git a/src/GetDocumentInsider/Commands/CommandBase.cs b/src/GetDocumentInsider/Commands/CommandBase.cs
index 4f66e51d5e..61e83151ce 100644
--- a/src/GetDocumentInsider/Commands/CommandBase.cs
+++ b/src/GetDocumentInsider/Commands/CommandBase.cs
@@ -1,10 +1,10 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-using GetDocument.Properties;
using Microsoft.DotNet.Cli.CommandLine;
+using Microsoft.Extensions.ApiDescription.Client.Properties;
-namespace GetDocument.Commands
+namespace Microsoft.Extensions.ApiDescription.Client.Commands
{
internal abstract class CommandBase
{
diff --git a/src/GetDocumentInsider/Commands/GetDocumentCommand.cs b/src/GetDocumentInsider/Commands/GetDocumentCommand.cs
index f615e4399b..af61b02af6 100644
--- a/src/GetDocumentInsider/Commands/GetDocumentCommand.cs
+++ b/src/GetDocumentInsider/Commands/GetDocumentCommand.cs
@@ -8,17 +8,17 @@ using System.Reflection;
#if NETCOREAPP2_0
using System.Runtime.Loader;
#endif
-using GetDocument.Properties;
using Microsoft.DotNet.Cli.CommandLine;
+using Microsoft.Extensions.ApiDescription.Client.Properties;
-namespace GetDocument.Commands
+namespace Microsoft.Extensions.ApiDescription.Client.Commands
{
internal class GetDocumentCommand : ProjectCommandBase
{
internal const string FallbackDocumentName = "v1";
internal const string FallbackMethod = "Generate";
internal const string FallbackService = "Microsoft.Extensions.ApiDescription.IDocumentProvider";
- private const string WorkerType = "GetDocument.Commands.GetDocumentCommandWorker";
+ private const string WorkerType = "Microsoft.Extensions.ApiDescription.Client.Commands.GetDocumentCommandWorker";
private CommandOption _documentName;
private CommandOption _method;
diff --git a/src/GetDocumentInsider/Commands/GetDocumentCommandContext.cs b/src/GetDocumentInsider/Commands/GetDocumentCommandContext.cs
index 996e9e9701..65b3589af2 100644
--- a/src/GetDocumentInsider/Commands/GetDocumentCommandContext.cs
+++ b/src/GetDocumentInsider/Commands/GetDocumentCommandContext.cs
@@ -1,6 +1,6 @@
using System;
-namespace GetDocument.Commands
+namespace Microsoft.Extensions.ApiDescription.Client.Commands
{
[Serializable]
public class GetDocumentCommandContext
diff --git a/src/GetDocumentInsider/Commands/GetDocumentCommandWorker.cs b/src/GetDocumentInsider/Commands/GetDocumentCommandWorker.cs
index c010165e61..97a1f4e809 100644
--- a/src/GetDocumentInsider/Commands/GetDocumentCommandWorker.cs
+++ b/src/GetDocumentInsider/Commands/GetDocumentCommandWorker.cs
@@ -4,14 +4,13 @@ using System.IO;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
-using GenerationTasks;
-using GetDocument.Properties;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
+using Microsoft.Extensions.ApiDescription.Client.Properties;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
-namespace GetDocument.Commands
+namespace Microsoft.Extensions.ApiDescription.Client.Commands
{
internal class GetDocumentCommandWorker
{
diff --git a/src/GetDocumentInsider/Commands/HelpCommandBase.cs b/src/GetDocumentInsider/Commands/HelpCommandBase.cs
index 7e2c89cb5a..3f80564d54 100644
--- a/src/GetDocumentInsider/Commands/HelpCommandBase.cs
+++ b/src/GetDocumentInsider/Commands/HelpCommandBase.cs
@@ -3,7 +3,7 @@
using Microsoft.DotNet.Cli.CommandLine;
-namespace GetDocument.Commands
+namespace Microsoft.Extensions.ApiDescription.Client.Commands
{
internal class HelpCommandBase : CommandBase
{
diff --git a/src/GetDocumentInsider/Commands/ProjectCommandBase.cs b/src/GetDocumentInsider/Commands/ProjectCommandBase.cs
index a1a762f96c..71e74947d0 100644
--- a/src/GetDocumentInsider/Commands/ProjectCommandBase.cs
+++ b/src/GetDocumentInsider/Commands/ProjectCommandBase.cs
@@ -1,10 +1,10 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-using GetDocument.Properties;
using Microsoft.DotNet.Cli.CommandLine;
+using Microsoft.Extensions.ApiDescription.Client.Properties;
-namespace GetDocument.Commands
+namespace Microsoft.Extensions.ApiDescription.Client.Commands
{
internal abstract class ProjectCommandBase : HelpCommandBase
{
diff --git a/src/GetDocumentInsider/GetDocumentInsider.csproj b/src/GetDocumentInsider/GetDocumentInsider.csproj
index 8fe28cd313..abd288edd7 100644
--- a/src/GetDocumentInsider/GetDocumentInsider.csproj
+++ b/src/GetDocumentInsider/GetDocumentInsider.csproj
@@ -4,7 +4,7 @@
GetDocument Command-line Tool inside man
false
Exe
- GetDocument
+ Microsoft.Extensions.ApiDescription.Client
netcoreapp2.0;net461
diff --git a/src/GetDocumentInsider/Json.cs b/src/GetDocumentInsider/Json.cs
index acb62e449f..7e93ac21cd 100644
--- a/src/GetDocumentInsider/Json.cs
+++ b/src/GetDocumentInsider/Json.cs
@@ -1,10 +1,10 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-using GetDocument.Properties;
using Microsoft.DotNet.Cli.CommandLine;
+using Microsoft.Extensions.ApiDescription.Client.Properties;
-namespace GetDocument
+namespace Microsoft.Extensions.ApiDescription.Client
{
internal static class Json
{
diff --git a/src/GetDocumentInsider/LogWrapper.cs b/src/GetDocumentInsider/LogWrapper.cs
index 0ab10cb744..b4ee5b4f9b 100644
--- a/src/GetDocumentInsider/LogWrapper.cs
+++ b/src/GetDocumentInsider/LogWrapper.cs
@@ -1,7 +1,6 @@
using System;
-using GenerationTasks;
-namespace GetDocument
+namespace Microsoft.Extensions.ApiDescription.Client
{
public class LogWrapper : ILogWrapper
{
diff --git a/src/GetDocumentInsider/ProductInfo.cs b/src/GetDocumentInsider/ProductInfo.cs
index 22045ee0df..8db001423a 100644
--- a/src/GetDocumentInsider/ProductInfo.cs
+++ b/src/GetDocumentInsider/ProductInfo.cs
@@ -3,18 +3,10 @@
using System.Reflection;
-namespace GetDocument
+namespace Microsoft.Extensions.ApiDescription.Client
{
- ///
- /// This API supports the GetDocument infrastructure and is not intended to be used
- /// directly from your code. This API may change or be removed in future releases.
- ///
- public static class ProductInfo
+ internal static class ProductInfo
{
- ///
- /// This API supports the GetDocument infrastructure and is not intended to be used
- /// directly from your code. This API may change or be removed in future releases.
- ///
public static string GetVersion()
=> typeof(ProductInfo)
.Assembly
diff --git a/src/GetDocumentInsider/Program.cs b/src/GetDocumentInsider/Program.cs
index 935fca4de0..2f2f43a4c0 100644
--- a/src/GetDocumentInsider/Program.cs
+++ b/src/GetDocumentInsider/Program.cs
@@ -3,10 +3,10 @@
using System;
using System.Text;
-using GetDocument.Commands;
using Microsoft.DotNet.Cli.CommandLine;
+using Microsoft.Extensions.ApiDescription.Client.Commands;
-namespace GetDocument
+namespace Microsoft.Extensions.ApiDescription.Client
{
internal static class Program
{
@@ -33,7 +33,7 @@ namespace GetDocument
if (ex is CommandException
|| ex is CommandParsingException
|| (ex is WrappedException wrappedException
- && wrappedException.Type == "GetDocument.Design.OperationException"))
+ && wrappedException.Type == "Microsoft.Extensions.ApiDescription.Client.Design.OperationException"))
{
Reporter.WriteVerbose(ex.ToString());
}
diff --git a/src/GetDocumentInsider/Properties/Resources.Designer.cs b/src/GetDocumentInsider/Properties/Resources.Designer.cs
index 90463782ab..7f3066776c 100644
--- a/src/GetDocumentInsider/Properties/Resources.Designer.cs
+++ b/src/GetDocumentInsider/Properties/Resources.Designer.cs
@@ -5,7 +5,7 @@ using System.Reflection;
using System.Resources;
using JetBrains.Annotations;
-namespace GetDocument.Properties
+namespace Microsoft.Extensions.ApiDescription.Client.Properties
{
///
/// This API supports the GetDocument infrastructure and is not intended to be used
@@ -14,7 +14,7 @@ namespace GetDocument.Properties
internal static class Resources
{
private static readonly ResourceManager _resourceManager
- = new ResourceManager("GetDocument.Properties.Resources", typeof(Resources).GetTypeInfo().Assembly);
+ = new ResourceManager("Microsoft.Extensions.ApiDescription.Client.Properties.Resources", typeof(Resources).GetTypeInfo().Assembly);
///
/// The assembly to use.
diff --git a/src/GetDocumentInsider/Properties/Resources.Designer.tt b/src/GetDocumentInsider/Properties/Resources.Designer.tt
index 3f636a4db5..29bb487272 100644
--- a/src/GetDocumentInsider/Properties/Resources.Designer.tt
+++ b/src/GetDocumentInsider/Properties/Resources.Designer.tt
@@ -3,4 +3,4 @@
Session["AccessModifier"] = "internal";
Session["NoDiagnostics"] = true;
#>
-<#@ include file="..\..\tools\Resources.tt" #>
+<#@ include file="..\..\..\tools\Resources.tt" #>
diff --git a/src/GetDocumentInsider/Reporter.cs b/src/GetDocumentInsider/Reporter.cs
index b7c0c264a5..abfec580fb 100644
--- a/src/GetDocumentInsider/Reporter.cs
+++ b/src/GetDocumentInsider/Reporter.cs
@@ -3,9 +3,9 @@
using System;
using System.Linq;
-using static GetDocument.AnsiConstants;
+using static Microsoft.Extensions.ApiDescription.Client.AnsiConstants;
-namespace GetDocument
+namespace Microsoft.Extensions.ApiDescription.Client
{
internal static class Reporter
{
diff --git a/src/GetDocumentInsider/WrappedException.cs b/src/GetDocumentInsider/WrappedException.cs
index 7cd7bfc0d3..ec90fb6061 100644
--- a/src/GetDocumentInsider/WrappedException.cs
+++ b/src/GetDocumentInsider/WrappedException.cs
@@ -3,7 +3,7 @@
using System;
-namespace GetDocument
+namespace Microsoft.Extensions.ApiDescription.Client
{
internal class WrappedException : Exception
{
diff --git a/src/Microsoft.Extensions.ApiDescription.Client/DownloadFile.cs b/src/Microsoft.Extensions.ApiDescription.Client/DownloadFile.cs
index a1341e0581..1e79fd9722 100644
--- a/src/Microsoft.Extensions.ApiDescription.Client/DownloadFile.cs
+++ b/src/Microsoft.Extensions.ApiDescription.Client/DownloadFile.cs
@@ -11,7 +11,7 @@ using Microsoft.Build.Utilities;
using Task = System.Threading.Tasks.Task;
using Utilities = Microsoft.Build.Utilities;
-namespace GenerationTasks
+namespace Microsoft.Extensions.ApiDescription.Client
{
///
/// Downloads a file.
diff --git a/src/Microsoft.Extensions.ApiDescription.Client/DownloadFileCore.cs b/src/Microsoft.Extensions.ApiDescription.Client/DownloadFileCore.cs
index bf8156e32f..5fd655fb85 100644
--- a/src/Microsoft.Extensions.ApiDescription.Client/DownloadFileCore.cs
+++ b/src/Microsoft.Extensions.ApiDescription.Client/DownloadFileCore.cs
@@ -6,7 +6,7 @@ using System.Security.Cryptography;
using System.Threading;
using System.Threading.Tasks;
-namespace GenerationTasks
+namespace Microsoft.Extensions.ApiDescription.Client
{
internal static class DownloadFileCore
{
diff --git a/src/Microsoft.Extensions.ApiDescription.Client/GetFileReferenceMetadata.cs b/src/Microsoft.Extensions.ApiDescription.Client/GetFileReferenceMetadata.cs
index 6ae50f8b21..2c0717b695 100644
--- a/src/Microsoft.Extensions.ApiDescription.Client/GetFileReferenceMetadata.cs
+++ b/src/Microsoft.Extensions.ApiDescription.Client/GetFileReferenceMetadata.cs
@@ -4,7 +4,7 @@ using System.IO;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
-namespace GenerationTasks
+namespace Microsoft.Extensions.ApiDescription.Client
{
///
/// Adds or corrects Namespace and OutputPath metadata in ServiceFileReference items.
diff --git a/src/Microsoft.Extensions.ApiDescription.Client/GetProjectReferenceMetadata.cs b/src/Microsoft.Extensions.ApiDescription.Client/GetProjectReferenceMetadata.cs
index e8ac95a819..379e674787 100644
--- a/src/Microsoft.Extensions.ApiDescription.Client/GetProjectReferenceMetadata.cs
+++ b/src/Microsoft.Extensions.ApiDescription.Client/GetProjectReferenceMetadata.cs
@@ -4,7 +4,7 @@ using System.IO;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
-namespace GenerationTasks
+namespace Microsoft.Extensions.ApiDescription.Client
{
///
/// Adds or corrects DocumentPath and project-related metadata in ServiceProjectReference items.
diff --git a/src/Microsoft.Extensions.ApiDescription.Client/GetUriReferenceMetadata.cs b/src/Microsoft.Extensions.ApiDescription.Client/GetUriReferenceMetadata.cs
index 7d922e19dc..fc0f836ca0 100644
--- a/src/Microsoft.Extensions.ApiDescription.Client/GetUriReferenceMetadata.cs
+++ b/src/Microsoft.Extensions.ApiDescription.Client/GetUriReferenceMetadata.cs
@@ -4,7 +4,7 @@ using System.IO;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
-namespace GenerationTasks
+namespace Microsoft.Extensions.ApiDescription.Client
{
///
/// Adds or corrects DocumentPath metadata in ServiceUriReference items.
diff --git a/src/Microsoft.Extensions.ApiDescription.Client/ILogWrapper.cs b/src/Microsoft.Extensions.ApiDescription.Client/ILogWrapper.cs
index 7c773ab359..8f7f66396d 100644
--- a/src/Microsoft.Extensions.ApiDescription.Client/ILogWrapper.cs
+++ b/src/Microsoft.Extensions.ApiDescription.Client/ILogWrapper.cs
@@ -1,6 +1,6 @@
using System;
-namespace GenerationTasks
+namespace Microsoft.Extensions.ApiDescription.Client
{
internal interface ILogWrapper
{
diff --git a/src/Microsoft.Extensions.ApiDescription.Client/LogWrapper.cs b/src/Microsoft.Extensions.ApiDescription.Client/LogWrapper.cs
index 75ae1407a8..98358ee91b 100644
--- a/src/Microsoft.Extensions.ApiDescription.Client/LogWrapper.cs
+++ b/src/Microsoft.Extensions.ApiDescription.Client/LogWrapper.cs
@@ -1,7 +1,7 @@
using System;
using Microsoft.Build.Utilities;
-namespace GenerationTasks
+namespace Microsoft.Extensions.ApiDescription.Client
{
internal class LogWrapper : ILogWrapper
{
diff --git a/src/Microsoft.Extensions.ApiDescription.Client/Microsoft.Extensions.ApiDescription.Client.csproj b/src/Microsoft.Extensions.ApiDescription.Client/Microsoft.Extensions.ApiDescription.Client.csproj
index 5dab6ea1aa..3041a7ea51 100644
--- a/src/Microsoft.Extensions.ApiDescription.Client/Microsoft.Extensions.ApiDescription.Client.csproj
+++ b/src/Microsoft.Extensions.ApiDescription.Client/Microsoft.Extensions.ApiDescription.Client.csproj
@@ -11,7 +11,6 @@
false
$(MSBuildProjectName).nuspec
Build Tasks;msbuild;DownloadFile;GetFilenameFromUri;code generation
- GenerationTasks
netstandard2.0;net461
diff --git a/src/Microsoft.Extensions.ApiDescription.Client/build/GenerationTasks.props b/src/Microsoft.Extensions.ApiDescription.Client/build/GenerationTasks.props
index dc67dca96a..989e7d9b23 100644
--- a/src/Microsoft.Extensions.ApiDescription.Client/build/GenerationTasks.props
+++ b/src/Microsoft.Extensions.ApiDescription.Client/build/GenerationTasks.props
@@ -2,15 +2,15 @@
- <_GenerationTasksAssemblyTarget Condition="'$(MSBuildRuntimeType)' == 'Core'">netstandard2.0
- <_GenerationTasksAssemblyTarget Condition="'$(MSBuildRuntimeType)' != 'Core'">net461
- <_GenerationTasksAssemblyPath>$(MSBuildThisFileDirectory)/../tasks/$(_GenerationTasksAssemblyTarget)/GenerationTasks.dll
- <_GenerationTasksAssemblyTarget />
+ <_ApiDescriptionTasksAssemblyTarget Condition="'$(MSBuildRuntimeType)' == 'Core'">netstandard2.0
+ <_ApiDescriptionTasksAssemblyTarget Condition="'$(MSBuildRuntimeType)' != 'Core'">net461
+ <_ApiDescriptionTasksAssemblyPath>$(MSBuildThisFileDirectory)/../tasks/$(_ApiDescriptionTasksAssemblyTarget)/Microsoft.Extensions.ApiDescription.Client.dll
+ <_ApiDescriptionTasksAssemblyTarget />
-
-
-
-
+
+
+
+
true
diff --git a/src/Microsoft.Extensions.ApiDescription.Client/build/GenerationTasks.targets b/src/Microsoft.Extensions.ApiDescription.Client/build/GenerationTasks.targets
index 7c70d7d279..1b9b1ac184 100644
--- a/src/Microsoft.Extensions.ApiDescription.Client/build/GenerationTasks.targets
+++ b/src/Microsoft.Extensions.ApiDescription.Client/build/GenerationTasks.targets
@@ -184,9 +184,9 @@
<_Temporary Remove="@(_Temporary)" />
-
+
-
+
@@ -196,7 +196,7 @@
-
@@ -215,9 +215,9 @@
<_Temporary Remove="@(_Temporary)" />
-
+
-
+
diff --git a/src/dotnet-getdocument/Commands/InvokeCommand.cs b/src/dotnet-getdocument/Commands/InvokeCommand.cs
index cf3308ec46..f28aafacf4 100644
--- a/src/dotnet-getdocument/Commands/InvokeCommand.cs
+++ b/src/dotnet-getdocument/Commands/InvokeCommand.cs
@@ -6,12 +6,12 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Versioning;
-using GetDocument.Properties;
using Microsoft.DotNet.Cli.CommandLine;
+using Microsoft.Extensions.ApiDescription.Client.Properties;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
-namespace GetDocument.Commands
+namespace Microsoft.Extensions.ApiDescription.Client.Commands
{
internal class InvokeCommand : HelpCommandBase
{
diff --git a/src/dotnet-getdocument/Exe.cs b/src/dotnet-getdocument/Exe.cs
index 0c8f7d89ae..32595ce9ab 100644
--- a/src/dotnet-getdocument/Exe.cs
+++ b/src/dotnet-getdocument/Exe.cs
@@ -5,7 +5,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
-namespace GetDocument
+namespace Microsoft.Extensions.ApiDescription.Client
{
internal static class Exe
{
diff --git a/src/dotnet-getdocument/Program.cs b/src/dotnet-getdocument/Program.cs
index 495573a776..b93d3e1144 100644
--- a/src/dotnet-getdocument/Program.cs
+++ b/src/dotnet-getdocument/Program.cs
@@ -2,11 +2,11 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
-using GetDocument.Commands;
-using GetDocument.Properties;
using Microsoft.DotNet.Cli.CommandLine;
+using Microsoft.Extensions.ApiDescription.Client.Commands;
+using Microsoft.Extensions.ApiDescription.Client.Properties;
-namespace GetDocument
+namespace Microsoft.Extensions.ApiDescription.Client
{
internal static class Program
{
diff --git a/src/dotnet-getdocument/Project.cs b/src/dotnet-getdocument/Project.cs
index 274960a08b..b778838ed8 100644
--- a/src/dotnet-getdocument/Project.cs
+++ b/src/dotnet-getdocument/Project.cs
@@ -5,14 +5,14 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
-using GetDocument.Properties;
+using Microsoft.Extensions.ApiDescription.Client.Properties;
using IODirectory = System.IO.Directory;
-namespace GetDocument
+namespace Microsoft.Extensions.ApiDescription.Client
{
internal class Project
{
- private const string MSBuildResourceName = "GetDocument.ServiceProjectReferenceMetadata";
+ private const string MSBuildResourceName = "Microsoft.Extensions.ApiDescription.Client.ServiceProjectReferenceMetadata";
private Project()
{
diff --git a/src/dotnet-getdocument/ProjectOptions.cs b/src/dotnet-getdocument/ProjectOptions.cs
index bca160eeaa..59ddd4d48d 100644
--- a/src/dotnet-getdocument/ProjectOptions.cs
+++ b/src/dotnet-getdocument/ProjectOptions.cs
@@ -1,10 +1,10 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-using GetDocument.Properties;
using Microsoft.DotNet.Cli.CommandLine;
+using Microsoft.Extensions.ApiDescription.Client.Properties;
-namespace GetDocument
+namespace Microsoft.Extensions.ApiDescription.Client
{
internal class ProjectOptions
{
diff --git a/src/dotnet-getdocument/Properties/Resources.Designer.cs b/src/dotnet-getdocument/Properties/Resources.Designer.cs
index 3ee7f0ba79..351107083c 100644
--- a/src/dotnet-getdocument/Properties/Resources.Designer.cs
+++ b/src/dotnet-getdocument/Properties/Resources.Designer.cs
@@ -5,7 +5,7 @@ using System.Reflection;
using System.Resources;
using JetBrains.Annotations;
-namespace GetDocument.Properties
+namespace Microsoft.Extensions.ApiDescription.Client.Properties
{
///
/// This API supports the GetDocument infrastructure and is not intended to be used
@@ -14,7 +14,7 @@ namespace GetDocument.Properties
internal static class Resources
{
private static readonly ResourceManager _resourceManager
- = new ResourceManager("GetDocument.Properties.Resources", typeof(Resources).GetTypeInfo().Assembly);
+ = new ResourceManager("Microsoft.Extensions.ApiDescription.Client.Properties.Resources", typeof(Resources).GetTypeInfo().Assembly);
///
/// The configuration to use.
@@ -23,7 +23,7 @@ namespace GetDocument.Properties
=> GetString("ConfigurationDescription");
///
- /// dotnet getdocument
+ /// dotnet-getdocument
///
public static string CommandFullName
=> GetString("CommandFullName");
@@ -55,7 +55,7 @@ namespace GetDocument.Properties
projectDirectory);
///
- /// Project '{Project}' targets framework '.NETCoreApp' version '{targetFrameworkVersion}'. This version of the GetDocument Command-line Tool only supports version 2.0 or higher.
+ /// Project '{Project}' targets framework '.NETCoreApp' version '{targetFrameworkVersion}'. This version of the dotnet-getdocument tool only supports version 2.0 or higher.
///
public static string NETCoreApp1Project([CanBeNull] object Project, [CanBeNull] object targetFrameworkVersion)
=> string.Format(
@@ -63,7 +63,7 @@ namespace GetDocument.Properties
Project, targetFrameworkVersion);
///
- /// Project '{Project}' targets framework '.NETStandard'. There is no runtime associated with this framework, and projects targeting it cannot be executed directly. To use the GetDocument Command-line Tool with this project, add an executable project targeting .NET Core or .NET Framework that references this project and specify it using the --project option; or, update this project to target .NET Core and / or .NET Framework.
+ /// Project '{Project}' targets framework '.NETStandard'. There is no runtime associated with this framework, and projects targeting it cannot be executed directly. To use the dotnet-getdocument tool with this project, add an executable project targeting .NET Core or .NET Framework that references this project and specify it using the --project option; or, update this project to target .NET Core and / or .NET Framework.
///
public static string NETStandardProject([CanBeNull] object Project)
=> string.Format(
@@ -115,7 +115,7 @@ namespace GetDocument.Properties
=> GetString("RuntimeDescription");
///
- /// Project '{Project}' targets framework '{targetFramework}'. The GetDocument Command-line Tool does not support this framework.
+ /// Project '{Project}' targets framework '{targetFramework}'. The dotnet-getdocument tool does not support this framework.
///
public static string UnsupportedFramework([CanBeNull] object Project, [CanBeNull] object targetFramework)
=> string.Format(
diff --git a/src/dotnet-getdocument/Properties/Resources.Designer.tt b/src/dotnet-getdocument/Properties/Resources.Designer.tt
index 3f636a4db5..29bb487272 100644
--- a/src/dotnet-getdocument/Properties/Resources.Designer.tt
+++ b/src/dotnet-getdocument/Properties/Resources.Designer.tt
@@ -3,4 +3,4 @@
Session["AccessModifier"] = "internal";
Session["NoDiagnostics"] = true;
#>
-<#@ include file="..\..\tools\Resources.tt" #>
+<#@ include file="..\..\..\tools\Resources.tt" #>
diff --git a/src/dotnet-getdocument/Properties/Resources.resx b/src/dotnet-getdocument/Properties/Resources.resx
index 16e16b8086..dc049de189 100644
--- a/src/dotnet-getdocument/Properties/Resources.resx
+++ b/src/dotnet-getdocument/Properties/Resources.resx
@@ -121,7 +121,7 @@
The configuration to use.
- dotnet getdocument
+ dotnet-getdocument
The target framework.
@@ -136,10 +136,10 @@
More than one project was found in directory '{projectDirectory}'. Specify one using its file name.
- Project '{Project}' targets framework '.NETCoreApp' version '{targetFrameworkVersion}'. This version of the GetDocument Command-line Tool only supports version 2.0 or higher.
+ Project '{Project}' targets framework '.NETCoreApp' version '{targetFrameworkVersion}'. This version of the dotnet-getdocument tool only supports version 2.0 or higher.
- Project '{Project}' targets framework '.NETStandard'. There is no runtime associated with this framework, and projects targeting it cannot be executed directly. To use the GetDocument Command-line Tool with this project, add an executable project targeting .NET Core or .NET Framework that references this project and specify it using the --project option; or, update this project to target .NET Core and / or .NET Framework.
+ Project '{Project}' targets framework '.NETStandard'. There is no runtime associated with this framework, and projects targeting it cannot be executed directly. To use the dotnet-getdocument tool with this project, add an executable project targeting .NET Core or .NET Framework that references this project and specify it using the --project option; or, update this project to target .NET Core and / or .NET Framework.
Do not colorize output.
@@ -163,7 +163,7 @@
The runtime identifier to use.
- Project '{Project}' targets framework '{targetFramework}'. The GetDocument Command-line Tool does not support this framework.
+ Project '{Project}' targets framework '{targetFramework}'. The dotnet-getdocument tool does not support this framework.
Using project '{project}'.
diff --git a/src/dotnet-getdocument/dotnet-getdocument.csproj b/src/dotnet-getdocument/dotnet-getdocument.csproj
index b88db8367a..73d57bffd9 100644
--- a/src/dotnet-getdocument/dotnet-getdocument.csproj
+++ b/src/dotnet-getdocument/dotnet-getdocument.csproj
@@ -16,7 +16,7 @@
Exe
true
GetDocument;command line;command-line;tool
- GetDocument
+ Microsoft.Extensions.ApiDescription.Client
netcoreapp2.1
diff --git a/tools/Resources.tt b/tools/Resources.tt
new file mode 100644
index 0000000000..736a0cc442
--- /dev/null
+++ b/tools/Resources.tt
@@ -0,0 +1,226 @@
+<#@ template hostspecific="true" #>
+<#@ assembly name="EnvDTE" #>
+<#@ assembly name="System.Core" #>
+<#@ assembly name="System.Windows.Forms" #>
+<#@ import namespace="System.Collections" #>
+<#@ import namespace="System.Collections.Generic" #>
+<#@ import namespace="System.ComponentModel.Design" #>
+<#@ import namespace="System.IO" #>
+<#@ import namespace="System.Linq" #>
+<#@ import namespace="System.Resources" #>
+<#@ import namespace="System.Text.RegularExpressions" #>
+<#@ import namespace="EnvDTE" #>
+<#
+ var model = LoadResources();
+#>
+//
+
+using System;
+using System.Reflection;
+using System.Resources;
+using JetBrains.Annotations;
+<#
+ if (!model.NoDiagnostics)
+ {
+#>
+using Microsoft.EntityFrameworkCore.Diagnostics;
+using Microsoft.Extensions.Logging;
+<#
+ }
+#>
+
+namespace <#= model.Namespace #>
+{
+ ///
+ /// This API supports the GetDocument infrastructure and is not intended to be used
+ /// directly from your code. This API may change or be removed in future releases.
+ ///
+ <#= model.AccessModifier #> static class <#= model.Class #>
+ {
+ private static readonly ResourceManager _resourceManager
+ = new ResourceManager("<#= model.ResourceName #>", typeof(<#= model.Class #>).GetTypeInfo().Assembly);
+<#
+ foreach (var resource in model.Resources)
+ {
+#>
+
+ ///
+<#
+ foreach (var line in Lines(resource.Value))
+ {
+#>
+ /// <#= Xml(line) #>
+<#
+ }
+#>
+ ///
+<#
+ if (resource.ForLogging)
+ {
+ if (resource.Types.Count() > 6)
+ {
+#>
+ public static readonly FallbackEventDefinition <#= resource.Name #>
+ = new FallbackEventDefinition(
+ <#= resource.EventId #>,
+ LogLevel.<#= resource.Level #>,
+ "<#= resource.EventId #>",
+ _resourceManager.GetString("<#= resource.Name #>"));
+<#
+ }
+ else
+ {
+ var genericTypes = resource.Types.Any() ? ("<" + List(resource.Types) + ">") : "";
+#>
+ public static readonly EventDefinition<#= genericTypes #> <#= resource.Name #>
+ = new EventDefinition<#= genericTypes #>(
+ <#= resource.EventId #>,
+ LogLevel.<#= resource.Level #>,
+ "<#= resource.EventId #>",
+ LoggerMessage.Define<#= genericTypes #>(
+ LogLevel.<#= resource.Level #>,
+ <#= resource.EventId #>,
+ _resourceManager.GetString("<#= resource.Name #>")));
+<#
+ }
+ }
+ else
+ {
+ if (resource.Parameters.Any())
+ {
+#>
+ public static string <#= resource.Name #>(<#= List("[CanBeNull] object ", resource.Parameters) #>)
+ => string.Format(
+ GetString("<#= resource.Name #>", <#= List("nameof(", resource.Parameters, ")") #>),
+ <#= List(resource.Parameters) #>);
+<#
+ }
+ else
+ {
+#>
+ public static string <#= resource.Name #>
+ => GetString("<#= resource.Name #>");
+<#
+ }
+ }
+ }
+#>
+
+ private static string GetString(string name, params string[] formatterNames)
+ {
+ var value = _resourceManager.GetString(name);
+ for (var i = 0; i < formatterNames.Length; i++)
+ {
+ value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}");
+ }
+
+ return value;
+ }
+ }
+}
+<#+
+ ResourceFile LoadResources()
+ {
+ var result = new ResourceFile();
+
+ if (Session.ContainsKey("AccessModifier"))
+ {
+ result.AccessModifier = (string)Session["AccessModifier"];
+ };
+
+ var services = (IServiceProvider)Host;
+ var dte = (DTE)services.GetService(typeof(DTE));
+
+ if (!Session.TryGetValue("NoDiagnostics", out var noDiagnostics))
+ {
+ noDiagnostics = false;
+ }
+
+ result.NoDiagnostics = (bool)noDiagnostics;
+
+ var resourceFile = (string)Session["ResourceFile"];
+ if (!Path.IsPathRooted(resourceFile))
+ {
+ resourceFile = Host.ResolvePath(resourceFile);
+ }
+
+ var resourceProjectItem = dte.Solution.FindProjectItem(resourceFile);
+ var templateProjectItem = dte.Solution.FindProjectItem(Host.TemplateFile);
+ var project = templateProjectItem.ContainingProject;
+ var rootNamespace = (string)project.Properties.Item("RootNamespace").Value;
+ var resourceDir = Path.GetDirectoryName(resourceFile);
+ var projectDir = (string)project.Properties.Item("FullPath").Value;
+ var resourceNamespace = rootNamespace + "." + resourceDir.Substring(projectDir.Length)
+ .Replace(Path.DirectorySeparatorChar, '.');
+
+ result.Namespace = (string)resourceProjectItem.Properties.Item("CustomToolNamespace")?.Value;
+ if (string.IsNullOrEmpty(result.Namespace))
+ {
+ result.Namespace = resourceNamespace;
+ }
+
+ result.Class = Path.GetFileNameWithoutExtension(resourceFile);
+
+ result.ResourceName = resourceNamespace + "." + result.Class;
+
+ using (var reader = new ResXResourceReader(resourceFile))
+ {
+ reader.UseResXDataNodes = true;
+
+ result.Resources = Enumerable.ToList(
+ from DictionaryEntry r in reader
+ select new Resource((ResXDataNode)r.Value));
+ }
+
+ return result;
+ }
+
+ IEnumerable Lines(string value)
+ => value.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
+
+ string Xml(string value)
+ => value.Replace("<", "<").Replace(">", ">");
+
+ string List(IEnumerable items)
+ => List(null, items);
+
+ string List(string prefix, IEnumerable items, string suffix = null)
+ => string.Join(", ", items.Select(i => prefix + i + suffix));
+
+ class ResourceFile
+ {
+ public string Namespace { get; set; }
+ public string AccessModifier { get; set; } = "public";
+ public string Class { get; set; }
+ public string ResourceName { get; set; }
+ public IEnumerable Resources { get; set; }
+ public bool NoDiagnostics { get; set; }
+ }
+
+ class Resource
+ {
+ public Resource(ResXDataNode node)
+ {
+ Name = node.Name;
+ Value = (string)node.GetValue((ITypeResolutionService)null);
+ Parameters = Regex.Matches(Value, @"\{(\w+)\}")
+ .Cast()
+ .Select(m => m.Groups[1].Value)
+ .Distinct()
+ .ToList();
+
+ var eventInfo = node.Comment.Split(' ');
+ Level = eventInfo.FirstOrDefault() ?? "BadLevel";
+ EventId = eventInfo.Skip(1).FirstOrDefault() ?? "BadEventId";
+ Types = eventInfo.Skip(2).ToList();
+ }
+
+ public string Name { get; }
+ public string Value { get; }
+ public string EventId { get; }
+ public string Level { get; }
+ public bool ForLogging => Name.StartsWith("Log");
+ public IEnumerable Parameters { get; }
+ public IEnumerable Types { get; }
+ }
+#>
\ No newline at end of file