Break project into tool and inside man projects.

- Updated xproj to match latest tooling.
- Moved namespaces and classes to match the project they were in.
- Renamed / split resource files for their corresponding projects.
- Changed the x86 repacking to only impact the Microsoft.AspNetCore.Razor.Design project (it's the project that's always executed).
- Removed Dotnet.Cli.Utils dependency form Design. We weren't making use of the reporter anyways.

#80
This commit is contained in:
N. Taylor Mullen 2016-06-27 12:17:31 -07:00
Родитель 302ba3f85c
Коммит d9dfc2a6ac
26 изменённых файлов: 535 добавлений и 170 удалений

Просмотреть файл

@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{253024B2-368B-4B24-9CD3-D48E9C1EC948}"
EndProject
@ -12,30 +12,51 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{8D49C692-BA71-43C4-927F-E9E2BA8FC795}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Razor.Tools.Test", "test\Microsoft.AspNetCore.Razor.Tools.Test\Microsoft.AspNetCore.Razor.Tools.Test.xproj", "{AB04D3BA-0A35-4502-AD4F-E8D1B38A6E5B}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Razor.Tools", "src\Microsoft.AspNetCore.Razor.Tools\Microsoft.AspNetCore.Razor.Tools.xproj", "{6F1CAB8C-2315-46BB-B9B4-00564743590C}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Razor.Design", "src\Microsoft.AspNetCore.Razor.Design\Microsoft.AspNetCore.Razor.Design.xproj", "{60043E40-0D14-4E41-A97A-52A7A1BB5A26}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Razor.Design.Test", "test\Microsoft.AspNetCore.Razor.Design.Test\Microsoft.AspNetCore.Razor.Design.Test.xproj", "{C4279BCD-DADD-4354-B28D-B7FE24BAD230}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
debug_x86|Any CPU = debug_x86|Any CPU
Debug|Any CPU = Debug|Any CPU
release_x86|Any CPU = release_x86|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AB04D3BA-0A35-4502-AD4F-E8D1B38A6E5B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AB04D3BA-0A35-4502-AD4F-E8D1B38A6E5B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AB04D3BA-0A35-4502-AD4F-E8D1B38A6E5B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AB04D3BA-0A35-4502-AD4F-E8D1B38A6E5B}.Release|Any CPU.Build.0 = Release|Any CPU
{6F1CAB8C-2315-46BB-B9B4-00564743590C}.debug_x86|Any CPU.ActiveCfg = Debug|Any CPU
{6F1CAB8C-2315-46BB-B9B4-00564743590C}.debug_x86|Any CPU.Build.0 = Debug|Any CPU
{6F1CAB8C-2315-46BB-B9B4-00564743590C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6F1CAB8C-2315-46BB-B9B4-00564743590C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6F1CAB8C-2315-46BB-B9B4-00564743590C}.release_x86|Any CPU.ActiveCfg = Release|Any CPU
{6F1CAB8C-2315-46BB-B9B4-00564743590C}.release_x86|Any CPU.Build.0 = Release|Any CPU
{6F1CAB8C-2315-46BB-B9B4-00564743590C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6F1CAB8C-2315-46BB-B9B4-00564743590C}.Release|Any CPU.Build.0 = Release|Any CPU
{60043E40-0D14-4E41-A97A-52A7A1BB5A26}.debug_x86|Any CPU.ActiveCfg = debug_x86|Any CPU
{60043E40-0D14-4E41-A97A-52A7A1BB5A26}.debug_x86|Any CPU.Build.0 = debug_x86|Any CPU
{60043E40-0D14-4E41-A97A-52A7A1BB5A26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{60043E40-0D14-4E41-A97A-52A7A1BB5A26}.Debug|Any CPU.Build.0 = Debug|Any CPU
{60043E40-0D14-4E41-A97A-52A7A1BB5A26}.release_x86|Any CPU.ActiveCfg = release_x86|Any CPU
{60043E40-0D14-4E41-A97A-52A7A1BB5A26}.release_x86|Any CPU.Build.0 = release_x86|Any CPU
{60043E40-0D14-4E41-A97A-52A7A1BB5A26}.Release|Any CPU.ActiveCfg = Release|Any CPU
{60043E40-0D14-4E41-A97A-52A7A1BB5A26}.Release|Any CPU.Build.0 = Release|Any CPU
{C4279BCD-DADD-4354-B28D-B7FE24BAD230}.debug_x86|Any CPU.ActiveCfg = Debug|Any CPU
{C4279BCD-DADD-4354-B28D-B7FE24BAD230}.debug_x86|Any CPU.Build.0 = Debug|Any CPU
{C4279BCD-DADD-4354-B28D-B7FE24BAD230}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C4279BCD-DADD-4354-B28D-B7FE24BAD230}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C4279BCD-DADD-4354-B28D-B7FE24BAD230}.release_x86|Any CPU.ActiveCfg = Release|Any CPU
{C4279BCD-DADD-4354-B28D-B7FE24BAD230}.release_x86|Any CPU.Build.0 = Release|Any CPU
{C4279BCD-DADD-4354-B28D-B7FE24BAD230}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C4279BCD-DADD-4354-B28D-B7FE24BAD230}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{AB04D3BA-0A35-4502-AD4F-E8D1B38A6E5B} = {8D49C692-BA71-43C4-927F-E9E2BA8FC795}
{6F1CAB8C-2315-46BB-B9B4-00564743590C} = {253024B2-368B-4B24-9CD3-D48E9C1EC948}
{60043E40-0D14-4E41-A97A-52A7A1BB5A26} = {253024B2-368B-4B24-9CD3-D48E9C1EC948}
{C4279BCD-DADD-4354-B28D-B7FE24BAD230} = {8D49C692-BA71-43C4-927F-E9E2BA8FC795}
EndGlobalSection
EndGlobal

Просмотреть файл

@ -5,8 +5,8 @@ use namespace="System.Linq"
default CONFIGURATION_LOCAL='${E("Configuration")}'
default BASE_DIR_LOCAL='${Directory.GetCurrentDirectory()}'
default BUILD_DIR_LOCAL='${Path.Combine(BASE_DIR_LOCAL, "artifacts", "build")}'
default TOOL_PROJECT_NAME='Microsoft.AspNetCore.Razor.Tools'
default TOOL_EXE_NAME='dotnet-razor-tooling.exe'
default TOOL_PROJECT_NAME='Microsoft.AspNetCore.Razor.Design'
default TOOL_EXE_NAME='Microsoft.AspNetCore.Razor.Design.exe'
var VERSION='0.1'
var FULL_VERSION='0.1'
var AUTHORS='Microsoft Open Technologies, Inc.'

Просмотреть файл

@ -8,7 +8,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace Microsoft.AspNetCore.Razor.Tools {
namespace Microsoft.AspNetCore.Razor.Design {
using System;
using System.Reflection;
@ -22,13 +22,13 @@ namespace Microsoft.AspNetCore.Razor.Tools {
// with the /str option, or rebuild your VS project.
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Resources {
public class DesignResources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
internal Resources() {
internal DesignResources() {
}
/// <summary>
@ -38,7 +38,7 @@ namespace Microsoft.AspNetCore.Razor.Tools {
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.AspNetCore.Razor.Tools.Resources", typeof(Resources).GetTypeInfo().Assembly);
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.AspNetCore.Razor.Design.DesignResources", typeof(DesignResources).GetTypeInfo().Assembly);
resourceMan = temp;
}
return resourceMan;
@ -59,6 +59,15 @@ namespace Microsoft.AspNetCore.Razor.Tools {
}
}
/// <summary>
/// Looks up a localized string similar to Could not invoke tool. Ensure project.json has matching versions of &apos;{0}&apos; in the &apos;dependencies&apos; section and &apos;{1}&apos; in the &apos;tools&apos; section..
/// </summary>
public static string CouldNotInvokeTool {
get {
return ResourceManager.GetString("CouldNotInvokeTool", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Could not parse provided protocol &apos;{0}&apos;. Protocols should be valid int32 values..
/// </summary>
@ -68,15 +77,6 @@ namespace Microsoft.AspNetCore.Razor.Tools {
}
}
/// <summary>
/// Looks up a localized string similar to Failed to execute razor-tooling: &apos;{0}&apos;..
/// </summary>
public static string FailedToExecuteRazorTooling {
get {
return ResourceManager.GetString("FailedToExecuteRazorTooling", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &apos;{0}&apos;s cannot be resolved with protocol &apos;{1}&apos;. Protocol not supported..
/// </summary>
@ -85,14 +85,5 @@ namespace Microsoft.AspNetCore.Razor.Tools {
return ResourceManager.GetString("InvalidProtocolValue", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Project &apos;{0}&apos; does not support the provided framework &apos;{1}&apos;..
/// </summary>
public static string ProjectDoesNotSupportProvidedFramework {
get {
return ResourceManager.GetString("ProjectDoesNotSupportProvidedFramework", resourceCulture);
}
}
}
}

Просмотреть файл

@ -117,16 +117,13 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="CouldNotInvokeTool" xml:space="preserve">
<value>Could not invoke tool. Ensure project.json has matching versions of '{0}' in the 'dependencies' section and '{1}' in the 'tools' section.</value>
</data>
<data name="CouldNotParseProvidedProtocol" xml:space="preserve">
<value>Could not parse provided protocol '{0}'. Protocols should be valid int32 values.</value>
</data>
<data name="FailedToExecuteRazorTooling" xml:space="preserve">
<value>Failed to execute razor-tooling: '{0}'.</value>
</data>
<data name="InvalidProtocolValue" xml:space="preserve">
<value>'{0}'s cannot be resolved with protocol '{1}'. Protocol not supported.</value>
</data>
<data name="ProjectDoesNotSupportProvidedFramework" xml:space="preserve">
<value>Project '{0}' does not support the provided framework '{1}'.</value>
</data>
</root>

Просмотреть файл

@ -7,7 +7,7 @@ using System.Globalization;
using Microsoft.AspNetCore.Razor.Compilation.TagHelpers;
using Microsoft.AspNetCore.Razor.Runtime.TagHelpers;
namespace Microsoft.AspNetCore.Razor.Tools.Internal
namespace Microsoft.AspNetCore.Razor.Design.Internal
{
public class AssemblyTagHelperDescriptorResolver
{
@ -53,7 +53,7 @@ namespace Microsoft.AspNetCore.Razor.Tools.Internal
throw new InvalidOperationException(
string.Format(
CultureInfo.CurrentCulture,
Resources.InvalidProtocolValue,
DesignResources.InvalidProtocolValue,
typeof(TagHelperDescriptor).FullName, ProtocolVersion));
}
}

Просмотреть файл

@ -3,15 +3,13 @@
using System;
using System.Globalization;
using Microsoft.AspNetCore.Razor.Tools;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.Extensions.CommandLineUtils;
namespace Microsoft.AspNetCore.Razor.Tools.Internal
namespace Microsoft.AspNetCore.Razor.Design.Internal
{
public static class ResolveProtocolCommand
{
internal static void Register(CommandLineApplication app)
public static void Register(CommandLineApplication app)
{
app.Command("resolve-protocol", config =>
{
@ -28,17 +26,17 @@ namespace Microsoft.AspNetCore.Razor.Tools.Internal
int clientProtocol;
if (!int.TryParse(clientProtocolString, out clientProtocol))
{
Reporter.Error.WriteLine(
Console.Error.WriteLine(
string.Format(
CultureInfo.CurrentCulture,
Resources.CouldNotParseProvidedProtocol,
DesignResources.CouldNotParseProvidedProtocol,
clientProtocolString));
return 1;
}
var resolvedProtocol = ResolveProtocol(clientProtocol, pluginProtocol);
Reporter.Output.WriteLine(resolvedProtocol.ToString(CultureInfo.InvariantCulture));
Console.WriteLine(resolvedProtocol.ToString(CultureInfo.InvariantCulture));
return 0;
});

Просмотреть файл

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25413" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25413</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>60043e40-0d14-4e41-a97a-52a7a1bb5a26</ProjectGuid>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

Просмотреть файл

@ -0,0 +1,70 @@
// 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 System;
using System.Globalization;
using System.Linq;
using System.Reflection;
namespace Microsoft.AspNetCore.Razor.Design
{
public class Program
{
private readonly static Type ProgramType = typeof(Program);
public static int Main(string[] args)
{
var app = new RazorToolingApplication(ProgramType);
EnsureValidDispatchRecipient(ref args);
ResolveTagHelpersCommandBase.Register<ResolveTagHelpersRunCommand>(app);
return app.Execute(args);
}
private static void EnsureValidDispatchRecipient(ref string[] args)
{
const string DispatcherVersionArgumentName = "--dispatcher-version";
if (!args.Contains(DispatcherVersionArgumentName, StringComparer.OrdinalIgnoreCase))
{
return;
}
var dispatcherArgumentIndex = Array.FindIndex(
args,
(value) => string.Equals(value, DispatcherVersionArgumentName, StringComparison.OrdinalIgnoreCase));
var dispatcherArgumentValueIndex = dispatcherArgumentIndex + 1;
if (dispatcherArgumentValueIndex < args.Length)
{
var dispatcherVersion = args[dispatcherArgumentValueIndex];
var thisAssembly = ProgramType.GetTypeInfo().Assembly;
var version = thisAssembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
?.InformationalVersion
?? thisAssembly.GetName().Version.ToString();
if (string.Equals(dispatcherVersion, version, StringComparison.Ordinal))
{
// Remove dispatcher arguments from
var preDispatcherArgument = args.Take(dispatcherArgumentIndex);
var postDispatcherArgument = args.Skip(dispatcherArgumentIndex + 2);
var newProgramArguments = preDispatcherArgument.Concat(postDispatcherArgument);
args = newProgramArguments.ToArray();
return;
}
}
var thisAssemblyName = typeof(Program).GetTypeInfo().Assembly.GetName().Name;
// Could not validate the dispatcher version.
throw new InvalidOperationException(
string.Format(
CultureInfo.CurrentCulture,
DesignResources.CouldNotInvokeTool,
thisAssemblyName,
"Microsoft.AspNetCore.Razor.Tools"));
}
}
}

Просмотреть файл

@ -0,0 +1,11 @@
// 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 System.Reflection;
using System.Resources;
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: NeutralResourcesLanguage("en-us")]
[assembly: AssemblyCompany("Microsoft Corporation.")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyProduct("Microsoft ASP.NET Core")]

Просмотреть файл

@ -0,0 +1,61 @@
// 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 System;
using System.Reflection;
using Microsoft.AspNetCore.Razor.Design.Internal;
using Microsoft.Extensions.CommandLineUtils;
namespace Microsoft.AspNetCore.Razor.Design
{
public class RazorToolingApplication : CommandLineApplication
{
private readonly Type _callingType;
public RazorToolingApplication(Type callingType)
{
_callingType = callingType;
Name = "razor-tooling";
FullName = "Microsoft Razor Tooling Utility";
Description = "Resolves Razor tooling specific information.";
ShortVersionGetter = GetInformationalVersion;
HelpOption("-?|-h|--help");
OnExecute(() =>
{
ShowHelp();
return 2;
});
ResolveProtocolCommand.Register(this);
}
public new int Execute(params string[] args)
{
try
{
return base.Execute(args);
}
catch (Exception ex)
{
Console.Error.WriteLine(ex.Message);
return 1;
}
}
private string GetInformationalVersion()
{
var assembly = _callingType.GetTypeInfo().Assembly;
var attributes = assembly.GetCustomAttributes(
typeof(AssemblyInformationalVersionAttribute)) as AssemblyInformationalVersionAttribute[];
var versionAttribute = attributes.Length == 0 ?
assembly.GetName().Version.ToString() :
attributes[0].InformationalVersion;
return versionAttribute;
}
}
}

Просмотреть файл

@ -3,13 +3,11 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Razor;
using Microsoft.AspNetCore.Razor.Compilation.TagHelpers;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.Extensions.CommandLineUtils;
using Newtonsoft.Json;
namespace Microsoft.AspNetCore.Razor.Tools.Internal
namespace Microsoft.AspNetCore.Razor.Design
{
public abstract class ResolveTagHelpersCommandBase
{
@ -42,7 +40,7 @@ namespace Microsoft.AspNetCore.Razor.Tools.Internal
var serializedResult = JsonConvert.SerializeObject(resolvedResult, Formatting.Indented);
Reporter.Output.WriteLine(serializedResult);
Console.WriteLine(serializedResult);
}
protected void ReportError(string message)

Просмотреть файл

@ -4,8 +4,9 @@
using System.Collections.Generic;
using System.Globalization;
using Microsoft.AspNetCore.Razor.Compilation.TagHelpers;
using Microsoft.AspNetCore.Razor.Design.Internal;
namespace Microsoft.AspNetCore.Razor.Tools.Internal
namespace Microsoft.AspNetCore.Razor.Design
{
public class ResolveTagHelpersRunCommand : ResolveTagHelpersCommandBase
{
@ -20,7 +21,7 @@ namespace Microsoft.AspNetCore.Razor.Tools.Internal
ReportError(
string.Format(
CultureInfo.CurrentCulture,
Resources.CouldNotParseProvidedProtocol,
DesignResources.CouldNotParseProvidedProtocol,
protocolOptionValue));
return 0;
}

Просмотреть файл

@ -0,0 +1,54 @@
{
"version": "1.0.0-*",
"description": "Design-time components for Razor tooling.",
"packOptions": {
"repository": {
"type": "git",
"url": "git://github.com/AspNet/RazorTooling"
},
"tags": [
"cshtml",
"razor",
"taghelper",
"aspnetcore",
"taghelpers"
]
},
"buildOptions": {
"keyFile": "../../tools/Key.snk",
"warningsAsErrors": true,
"emitEntryPoint": true,
"nowarn": [
"CS1591"
],
"xmlDoc": true
},
"configurations": {
"debug_x86": {
"buildOptions": {
"platform": "anycpu32bitpreferred"
}
},
"release_x86": {
"buildOptions": {
"platform": "anycpu32bitpreferred"
}
}
},
"dependencies": {
"Microsoft.AspNetCore.Razor.Runtime": "1.1.0-*",
"Microsoft.Extensions.CommandLineUtils": "1.1.0-*",
"Newtonsoft.Json": "9.0.1"
},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0-*"
}
}
},
"net451": {}
}
}

Просмотреть файл

@ -8,6 +8,8 @@ using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Loader;
using Microsoft.AspNetCore.Razor.Design;
using Microsoft.AspNetCore.Razor.Design.Internal;
using Microsoft.AspNetCore.Razor.Runtime.TagHelpers;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.InternalAbstractions;

Просмотреть файл

@ -5,6 +5,8 @@ using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Razor.Design;
using Microsoft.DotNet.ProjectModel;
using Microsoft.Extensions.CommandLineUtils;
using Microsoft.Extensions.Internal;
@ -84,13 +86,15 @@ namespace Microsoft.AspNetCore.Razor.Tools.Internal
dispatchArgs.Add(ProtocolOption.Value());
}
var toolName = typeof(Design.Program).GetTypeInfo().Assembly.GetName().Name;
var dispatchCommand = DotnetToolDispatcher.CreateDispatchCommand(
dispatchArgs,
framework,
ConfigurationOption.Value(),
outputPath: null,
buildBasePath: BuildBasePathOption.Value(),
projectDirectory: projectFile.ProjectDirectory);
projectDirectory: projectFile.ProjectDirectory,
toolName: toolName);
using (var errorWriter = new StringWriter())
{
@ -105,7 +109,7 @@ namespace Microsoft.AspNetCore.Razor.Tools.Internal
ReportError(
string.Format(
CultureInfo.CurrentCulture,
Resources.FailedToExecuteRazorTooling,
ToolResources.FailedToExecuteRazorTooling,
errorWriter.ToString()));
}
@ -128,7 +132,7 @@ namespace Microsoft.AspNetCore.Razor.Tools.Internal
ReportError(
string.Format(
CultureInfo.CurrentCulture,
Resources.ProjectDoesNotSupportProvidedFramework,
ToolResources.ProjectDoesNotSupportProvidedFramework,
ProjectArgument.Value,
frameworkOptionValue));

Просмотреть файл

@ -1,17 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="14.0.25413" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25413</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>6f1cab8c-2315-46bb-b9b4-00564743590c</ProjectGuid>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\</OutputPath>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

Просмотреть файл

@ -1,12 +1,8 @@
// 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 System;
using System.Reflection;
using Microsoft.AspNetCore.Razor.Design;
using Microsoft.AspNetCore.Razor.Tools.Internal;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.Extensions.CommandLineUtils;
using Microsoft.Extensions.Internal;
namespace Microsoft.AspNetCore.Razor.Tools
{
@ -14,56 +10,11 @@ namespace Microsoft.AspNetCore.Razor.Tools
{
public static int Main(string[] args)
{
try
{
var app = new CommandLineApplication
{
Name = "razor-tooling",
FullName = "Microsoft Razor Tooling Utility",
Description = "Resolves Razor tooling specific information.",
ShortVersionGetter = GetInformationalVersion,
};
app.HelpOption("-?|-h|--help");
var app = new RazorToolingApplication(typeof(Program));
ResolveProtocolCommand.Register(app);
if (DotnetToolDispatcher.IsDispatcher(args))
{
ResolveTagHelpersCommandBase.Register<ResolveTagHelpersDispatchCommand>(app);
}
else
{
DotnetToolDispatcher.EnsureValidDispatchRecipient(ref args);
ResolveTagHelpersCommandBase.Register<ResolveTagHelpersRunCommand>(app);
}
app.OnExecute(() =>
{
app.ShowHelp();
return 2;
});
return app.Execute(args);
}
catch (Exception ex)
{
Reporter.Error.WriteLine(ex.Message);
return 1;
}
}
private static string GetInformationalVersion()
{
var assembly = typeof(Program).GetTypeInfo().Assembly;
var attributes = assembly.GetCustomAttributes(
typeof(AssemblyInformationalVersionAttribute)) as AssemblyInformationalVersionAttribute[];
var versionAttribute = attributes.Length == 0 ?
assembly.GetName().Version.ToString() :
attributes[0].InformationalVersion;
return versionAttribute;
}
}
}

80
src/Microsoft.AspNetCore.Razor.Tools/ToolResources.Designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,80 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Microsoft.AspNetCore.Razor.Tools {
using System;
using System.Reflection;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class ToolResources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
internal ToolResources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.AspNetCore.Razor.Tools.ToolResources", typeof(ToolResources).GetTypeInfo().Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to Failed to execute razor-tooling: &apos;{0}&apos;..
/// </summary>
public static string FailedToExecuteRazorTooling {
get {
return ResourceManager.GetString("FailedToExecuteRazorTooling", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Project &apos;{0}&apos; does not support the provided framework &apos;{1}&apos;..
/// </summary>
public static string ProjectDoesNotSupportProvidedFramework {
get {
return ResourceManager.GetString("ProjectDoesNotSupportProvidedFramework", resourceCulture);
}
}
}
}

Просмотреть файл

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="FailedToExecuteRazorTooling" xml:space="preserve">
<value>Failed to execute razor-tooling: '{0}'.</value>
</data>
<data name="ProjectDoesNotSupportProvidedFramework" xml:space="preserve">
<value>Project '{0}' does not support the provided framework '{1}'.</value>
</data>
</root>

Просмотреть файл

@ -24,28 +24,13 @@
],
"xmlDoc": true
},
"configurations": {
"debug_x86": {
"buildOptions": {
"platform": "anycpu32bitpreferred"
}
},
"release_x86": {
"buildOptions": {
"platform": "anycpu32bitpreferred"
}
}
},
"dependencies": {
"Microsoft.AspNetCore.Razor.Runtime": "1.1.0-*",
"Microsoft.AspNetCore.Razor.Design": "1.0.0-*",
"Microsoft.DotNet.Cli.Utils": "1.0.0-*",
"Microsoft.Extensions.CommandLineUtils": "1.1.0-*",
"Microsoft.Extensions.DotnetToolDispatcher.Sources": {
"type": "build",
"version": "1.1.0-*"
},
"Microsoft.Extensions.PlatformAbstractions": "1.1.0-*",
"Newtonsoft.Json": "9.0.1"
}
},
"frameworks": {
"netcoreapp1.0": {

Просмотреть файл

@ -4,17 +4,14 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.Loader;
using Microsoft.AspNetCore.Razor;
using Microsoft.AspNetCore.Razor.Compilation.TagHelpers;
using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.AspNetCore.Razor.Test.Internal;
using Microsoft.AspNetCore.Razor.Tools.Internal;
using Xunit;
namespace Microsoft.AspNetCore.Tooling.Razor
namespace Microsoft.AspNetCore.Razor.Design.Internal
{
public class RazorPluginTest
public class AssemblyTagHelperDescriptorResolverTest
{
private const string DefaultPrefix = "";

Просмотреть файл

@ -1,10 +1,9 @@
// 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 Microsoft.AspNetCore.Razor.Tools.Internal;
using Xunit;
namespace Microsoft.AspNetCore.Razor.Tools
namespace Microsoft.AspNetCore.Razor.Design.Internal
{
public class ResolveProtocolCommandTest
{

Просмотреть файл

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25413" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25413</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>c4279bcd-dadd-4354-b28d-b7fe24bad230</ProjectGuid>
<RootNamespace>Microsoft.AspNetCore.Razor.Design.Test</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

Просмотреть файл

@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Razor.TagHelpers;
using Newtonsoft.Json;
using Xunit;
namespace Microsoft.AspNetCore.Razor.Tools
namespace Microsoft.AspNetCore.Razor.Design
{
public class VisualStudioProtocolTest
{

Просмотреть файл

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>ab04d3ba-0a35-4502-ad4f-e8d1b38a6e5b</ProjectGuid>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<DevelopmentServerPort>3845</DevelopmentServerPort>
</PropertyGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>