Refocus Razor runtime assemblies

Microsoft.AspNetCore.Razor becomes the home for TagHelper-related types
that you use in your code.

Microsoft.AspNetCore.Razor.Runtime becomes the home type types you need
to build a view engine. User code should not need this package anymore.

None of these are breaking changes due to typeforwards.
This commit is contained in:
Ryan Nowak 2017-12-17 15:14:41 -08:00
parent 4b93741610
commit b900a82bc3
30 changed files with 81 additions and 51 deletions

View File

@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27128.0
VisualStudioVersion = 15.0.27130.2010
MinimumVisualStudioVersion = 15.0.26730.03
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3C0D6505-79B3-49D0-B4C3-176F0F1836ED}"
ProjectSection(SolutionItems) = preProject
@ -82,11 +82,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Design.Test", "test\Microsoft.AspNetCore.Razor.Design.Test\Microsoft.AspNetCore.Razor.Design.Test.csproj", "{1D90F276-E1CA-4FDF-A173-EB889E7D3150}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.Razor.GenerateTool", "src\Microsoft.AspNetCore.Razor.GenerateTool\Microsoft.AspNetCore.Razor.GenerateTool.csproj", "{8052F088-1204-427B-BB0D-BE3D3BA6811B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.GenerateTool", "src\Microsoft.AspNetCore.Razor.GenerateTool\Microsoft.AspNetCore.Razor.GenerateTool.csproj", "{8052F088-1204-427B-BB0D-BE3D3BA6811B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.Razor.Tasks", "src\Microsoft.AspNetCore.Razor.Tasks\Microsoft.AspNetCore.Razor.Tasks.csproj", "{043B9497-C0BA-4770-9210-4456D2F81CE0}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Tasks", "src\Microsoft.AspNetCore.Razor.Tasks\Microsoft.AspNetCore.Razor.Tasks.csproj", "{043B9497-C0BA-4770-9210-4456D2F81CE0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.Razor.TagHelperTool", "src\Microsoft.AspNetCore.Razor.TagHelperTool\Microsoft.AspNetCore.Razor.TagHelperTool.csproj", "{AFD77E2F-1A4A-4C2C-9EA9-7E48C8926780}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.TagHelperTool", "src\Microsoft.AspNetCore.Razor.TagHelperTool\Microsoft.AspNetCore.Razor.TagHelperTool.csproj", "{AFD77E2F-1A4A-4C2C-9EA9-7E48C8926780}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Test", "test\Microsoft.AspNetCore.Razor.Test\Microsoft.AspNetCore.Razor.Test.csproj", "{323553F0-14AB-4FBD-9CF0-1CC0BE8056F8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -366,6 +368,14 @@ Global
{AFD77E2F-1A4A-4C2C-9EA9-7E48C8926780}.Release|Any CPU.Build.0 = Release|Any CPU
{AFD77E2F-1A4A-4C2C-9EA9-7E48C8926780}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
{AFD77E2F-1A4A-4C2C-9EA9-7E48C8926780}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
{323553F0-14AB-4FBD-9CF0-1CC0BE8056F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{323553F0-14AB-4FBD-9CF0-1CC0BE8056F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{323553F0-14AB-4FBD-9CF0-1CC0BE8056F8}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
{323553F0-14AB-4FBD-9CF0-1CC0BE8056F8}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU
{323553F0-14AB-4FBD-9CF0-1CC0BE8056F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{323553F0-14AB-4FBD-9CF0-1CC0BE8056F8}.Release|Any CPU.Build.0 = Release|Any CPU
{323553F0-14AB-4FBD-9CF0-1CC0BE8056F8}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
{323553F0-14AB-4FBD-9CF0-1CC0BE8056F8}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -405,6 +415,7 @@ Global
{8052F088-1204-427B-BB0D-BE3D3BA6811B} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED}
{043B9497-C0BA-4770-9210-4456D2F81CE0} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED}
{AFD77E2F-1A4A-4C2C-9EA9-7E48C8926780} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED}
{323553F0-14AB-4FBD-9CF0-1CC0BE8056F8} = {92463391-81BE-462B-AC3C-78C6C760741F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0035341D-175A-4D05-95E6-F1C2785A1E26}

View File

@ -5,7 +5,6 @@ using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.AspNetCore.Html;
using Microsoft.Extensions.Internal;
namespace Microsoft.AspNetCore.Razor.TagHelpers.Testing
{
@ -35,11 +34,7 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers.Testing
public int GetHashCode(TagHelperAttribute attribute)
{
var hashCodeCombiner = HashCodeCombiner.Start();
hashCodeCombiner.Add(attribute.GetHashCode());
hashCodeCombiner.Add(attribute.Name, StringComparer.Ordinal);
return hashCodeCombiner.CombinedHash;
return attribute.GetHashCode();
}
private string GetString(object value)

View File

@ -1,15 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Summary>Runtime components for rendering Razor pages and implementing tag helpers.</Summary>
<Description>$(Summary)
Commonly used types:
Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNameAttribute
Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute
Microsoft.AspNetCore.Razor.TagHelpers.ITagHelper</Description>
<Description>Runtime infrastructure for rendering Razor pages and tag helpers.</Description>
<TargetFramework>netstandard2.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PackageTags>$(PackageTags);taghelper;taghelpers</PackageTags>
</PropertyGroup>
@ -20,7 +13,6 @@ Microsoft.AspNetCore.Razor.TagHelpers.ITagHelper</Description>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Html.Abstractions" Version="$(MicrosoftAspNetCoreHtmlAbstractionsPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.CopyOnWriteDictionary.Sources" PrivateAssets="All" Version="$(MicrosoftExtensionsCopyOnWriteDictionarySourcesPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.HashCodeCombiner.Sources" PrivateAssets="All" Version="$(MicrosoftExtensionsHashCodeCombinerSourcesPackageVersion)" />
</ItemGroup>
</Project>

View File

@ -2,5 +2,24 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Runtime.CompilerServices;
using Microsoft.AspNetCore.Razor.TagHelpers;
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.Runtime.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: TypeForwardedTo(typeof(DefaultTagHelperContent))]
[assembly: TypeForwardedTo(typeof(HtmlAttributeNameAttribute))]
[assembly: TypeForwardedTo(typeof(HtmlAttributeNotBoundAttribute))]
[assembly: TypeForwardedTo(typeof(HtmlTargetElementAttribute))]
[assembly: TypeForwardedTo(typeof(ITagHelper))]
[assembly: TypeForwardedTo(typeof(ITagHelperComponent))]
[assembly: TypeForwardedTo(typeof(NullHtmlEncoder))]
[assembly: TypeForwardedTo(typeof(OutputElementHintAttribute))]
[assembly: TypeForwardedTo(typeof(ReadOnlyTagHelperAttributeList))]
[assembly: TypeForwardedTo(typeof(RestrictChildrenAttribute))]
[assembly: TypeForwardedTo(typeof(TagHelper))]
[assembly: TypeForwardedTo(typeof(TagHelperAttribute))]
[assembly: TypeForwardedTo(typeof(TagHelperAttributeList))]
[assembly: TypeForwardedTo(typeof(TagHelperComponent))]
[assembly: TypeForwardedTo(typeof(TagHelperContent))]
[assembly: TypeForwardedTo(typeof(TagHelperContext))]
[assembly: TypeForwardedTo(typeof(TagHelperOutput))]

View File

@ -1,8 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>Razor is a markup syntax for adding server-side logic to web pages. This package contains the Razor parser and code generation infrastructure.</Description>
<Summary>Razor is a markup syntax for adding server-side logic to web pages. This package contains runtime components for rendering Razor pages and implementing tag helpers.</Summary>
<Description>$(Summary)
Commonly used types:
Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNameAttribute
Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute
Microsoft.AspNetCore.Razor.TagHelpers.ITagHelper</Description>
<TargetFramework>netstandard2.0</TargetFramework>
<PackageTags>$(PackageTags);taghelper;taghelpers</PackageTags>
<!-- Required to implement an HtmlEncoder -->
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Html.Abstractions" Version="$(MicrosoftAspNetCoreHtmlAbstractionsPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.HashCodeCombiner.Sources" PrivateAssets="All" Version="$(MicrosoftExtensionsHashCodeCombinerSourcesPackageVersion)" />
</ItemGroup>
</Project>

View File

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Diagnostics;
using System.IO;
using System.Text.Encodings.Web;
using System.Threading.Tasks;

View File

@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(StandardTestTfms)</TargetFrameworks>
<DefaultItemExcludes>$(DefaultItemExcludes);TestFiles\**\*</DefaultItemExcludes>
</PropertyGroup>
<ItemGroup>
<None Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\shared\Microsoft.AspNetCore.Razor.TagHelpers.Testing.Sources\**\*.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Razor\Microsoft.AspNetCore.Razor.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(MicrosoftAspNetCoreTestingPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.WebEncoders" Version="$(MicrosoftExtensionsWebEncodersPackageVersion)" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPackageVersion)" />
<PackageReference Include="Moq" Version="$(MoqPackageVersion)" />
<PackageReference Include="xunit" Version="$(XunitPackageVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitRunnerVisualStudioPackageVersion)" />
</ItemGroup>
</Project>

View File

@ -7,7 +7,6 @@ using System.IO;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Razor.Runtime.TagHelpers;
using Microsoft.AspNetCore.Razor.TagHelpers.Testing;
using Microsoft.Extensions.WebEncoders.Testing;
using Xunit;
@ -1037,15 +1036,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
{
// Arrange
var writer = new StringWriter();
var tagHelperExecutionContext = new TagHelperExecutionContext(
tagName: output.TagName,
tagMode: output.TagMode,
items: new Dictionary<object, object>(),
uniqueId: string.Empty,
executeChildContentAsync: () => Task.FromResult(result: true),
startTagHelperWritingScope: _ => { },
endTagHelperWritingScope: () => new DefaultTagHelperContent());
tagHelperExecutionContext.Output = output;
var testEncoder = new HtmlTestEncoder();
// Act
@ -1067,16 +1057,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
var buffer = new HtmlContentBuilder();
var tagHelperExecutionContext = new TagHelperExecutionContext(
tagName: output.TagName,
tagMode: output.TagMode,
items: new Dictionary<object, object>(),
uniqueId: string.Empty,
executeChildContentAsync: () => Task.FromResult(result: true),
startTagHelperWritingScope: _ => { },
endTagHelperWritingScope: () => new DefaultTagHelperContent());
tagHelperExecutionContext.Output = output;
// Act
((IHtmlContentContainer)output).CopyTo(buffer);
@ -1097,16 +1077,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
var buffer = new HtmlContentBuilder();
var tagHelperExecutionContext = new TagHelperExecutionContext(
tagName: output.TagName,
tagMode: output.TagMode,
items: new Dictionary<object, object>(),
uniqueId: string.Empty,
executeChildContentAsync: () => Task.FromResult(result: true),
startTagHelperWritingScope: _ => { },
endTagHelperWritingScope: () => new DefaultTagHelperContent());
tagHelperExecutionContext.Output = output;
// Act
((IHtmlContentContainer)output).MoveTo(buffer);

Binary file not shown.