Fix dependency to aspnet/AspNetCore-Tooling (#170)

* Remove unused package versions
* Remove references to Html.Abstractions
Removing this package since it's from the aspnet/AspNetCore.

* Remove System.ValueTuple package inside remove
* Add versions.details.xml items from corefx
* Add Microsoft.NETCore.App
* Fill up Version.Details.xml
* Update dependencies
* Fix failing test
This commit is contained in:
Ryan Nowak 2019-01-24 16:57:16 -08:00 коммит произвёл Nate McMaster
Родитель e160872142
Коммит bd7fc9ddf6
31 изменённых файлов: 455 добавлений и 47 удалений

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

@ -1,7 +1,44 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Dependencies> <Dependencies>
<ProductDependencies></ProductDependencies> <ProductDependencies>
<Dependency Name="Microsoft.Extensions.CommandLineUtils.Sources" Version="3.0.0-preview.19074.2">
<Uri>https://github.com/aspnet/Extensions</Uri>
<Sha>0de62ae930da31048ba7e54c8cd0c6c0bcbd9095</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.HashCodeCombiner.Sources" Version="3.0.0-preview.19074.2">
<Uri>https://github.com/aspnet/Extensions</Uri>
<Sha>0de62ae930da31048ba7e54c8cd0c6c0bcbd9095</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.NonCapturingTimer.Sources" Version="3.0.0-preview.19074.2">
<Uri>https://github.com/aspnet/Extensions</Uri>
<Sha>0de62ae930da31048ba7e54c8cd0c6c0bcbd9095</Sha>
</Dependency>
<Dependency Name="System.Diagnostics.DiagnosticSource" Version="4.6.0-preview.19073.11">
<Uri>https://github.com/dotnet/corefx</Uri>
<Sha>351ca391579740ae8af8a5405cffa16d152ad6b2</Sha>
</Dependency>
<Dependency Name="System.Text.Encodings.Web" Version="4.6.0-preview.19073.11">
<Uri>https://github.com/dotnet/corefx</Uri>
<Sha>351ca391579740ae8af8a5405cffa16d152ad6b2</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.DependencyModel" Version="3.0.0-preview-27324-5">
<Uri>https://github.com/dotnet/core-setup</Uri>
<Sha>63a01b08e5d1d1a6b8544f598b3d3bda76e6e424</Sha>
</Dependency>
<Dependency Name="Microsoft.NETCore.App" Version="3.0.0-preview-27324-5">
<Uri>https://github.com/dotnet/core-setup</Uri>
<Sha>63a01b08e5d1d1a6b8544f598b3d3bda76e6e424</Sha>
</Dependency>
</ProductDependencies>
<ToolsetDependencies> <ToolsetDependencies>
<Dependency Name="Microsoft.AspNetCore.BenchmarkRunner.Sources" Version="3.0.0-preview.19074.2">
<Uri>https://github.com/aspnet/Extensions</Uri>
<Sha>0de62ae930da31048ba7e54c8cd0c6c0bcbd9095</Sha>
</Dependency>
<Dependency Name="Microsoft.AspNetCore.Testing" Version="3.0.0-preview.19074.2">
<Uri>https://github.com/aspnet/Extensions</Uri>
<Sha>0de62ae930da31048ba7e54c8cd0c6c0bcbd9095</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19073.5"> <Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19073.5">
<Uri>https://github.com/dotnet/arcade</Uri> <Uri>https://github.com/dotnet/arcade</Uri>
<Sha>af8ab7d7ca13d5f129c31cfa7aeda19f6d168e6e</Sha> <Sha>af8ab7d7ca13d5f129c31cfa7aeda19f6d168e6e</Sha>

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

@ -46,23 +46,21 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="Package Versions"> <PropertyGroup Label="Package Versions">
<BenchmarkDotNetPackageVersion>0.10.13</BenchmarkDotNetPackageVersion> <BenchmarkDotNetPackageVersion>0.10.13</BenchmarkDotNetPackageVersion>
<MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>3.0.0-preview-181106-14</MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion> <MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>3.0.0-preview.19074.2</MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>
<MicrosoftAspNetCoreHtmlAbstractionsPackageVersion>3.0.0-alpha1-10717</MicrosoftAspNetCoreHtmlAbstractionsPackageVersion> <MicrosoftAspNetCoreTestingPackageVersion>3.0.0-preview.19074.2</MicrosoftAspNetCoreTestingPackageVersion>
<MicrosoftAspNetCoreTestingPackageVersion>3.0.0-preview-181106-14</MicrosoftAspNetCoreTestingPackageVersion>
<MicrosoftBuildFrameworkPackageVersion>15.8.166</MicrosoftBuildFrameworkPackageVersion> <MicrosoftBuildFrameworkPackageVersion>15.8.166</MicrosoftBuildFrameworkPackageVersion>
<MicrosoftBuildPackageVersion>15.8.166</MicrosoftBuildPackageVersion> <MicrosoftBuildPackageVersion>15.8.166</MicrosoftBuildPackageVersion>
<MicrosoftBuildUtilitiesCorePackageVersion>15.8.166</MicrosoftBuildUtilitiesCorePackageVersion> <MicrosoftBuildUtilitiesCorePackageVersion>15.8.166</MicrosoftBuildUtilitiesCorePackageVersion>
<MicrosoftCodeAnalysisCommonPackageVersion>2.11.0-beta1-final</MicrosoftCodeAnalysisCommonPackageVersion> <MicrosoftCodeAnalysisCommonPackageVersion>2.11.0-beta1-final</MicrosoftCodeAnalysisCommonPackageVersion>
<MicrosoftCodeAnalysisCSharpPackageVersion>2.11.0-beta1-final</MicrosoftCodeAnalysisCSharpPackageVersion> <MicrosoftCodeAnalysisCSharpPackageVersion>2.11.0-beta1-final</MicrosoftCodeAnalysisCSharpPackageVersion>
<MicrosoftCodeAnalysisWorkspacesCommonPackageVersion>2.11.0-beta1-final</MicrosoftCodeAnalysisWorkspacesCommonPackageVersion> <MicrosoftCodeAnalysisWorkspacesCommonPackageVersion>2.11.0-beta1-final</MicrosoftCodeAnalysisWorkspacesCommonPackageVersion>
<MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>3.0.0-preview-181106-14</MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion> <MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>3.0.0-preview.19074.2</MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>
<MicrosoftExtensionsCopyOnWriteDictionarySourcesPackageVersion>3.0.0-preview-181106-14</MicrosoftExtensionsCopyOnWriteDictionarySourcesPackageVersion> <MicrosoftExtensionsDependencyModelPackageVersion>3.0.0-preview-27324-5</MicrosoftExtensionsDependencyModelPackageVersion>
<MicrosoftExtensionsDependencyModelPackageVersion>3.0.0-preview-27113-06</MicrosoftExtensionsDependencyModelPackageVersion> <MicrosoftExtensionsHashCodeCombinerSourcesPackageVersion>3.0.0-preview.19074.2</MicrosoftExtensionsHashCodeCombinerSourcesPackageVersion>
<MicrosoftExtensionsHashCodeCombinerSourcesPackageVersion>3.0.0-preview-181106-14</MicrosoftExtensionsHashCodeCombinerSourcesPackageVersion> <MicrosoftExtensionsNonCapturingTimerSourcesPackageVersion>3.0.0-preview.19074.2</MicrosoftExtensionsNonCapturingTimerSourcesPackageVersion>
<MicrosoftExtensionsNonCapturingTimerSourcesPackageVersion>3.0.0-preview-181106-14</MicrosoftExtensionsNonCapturingTimerSourcesPackageVersion> <MicrosoftNETCoreAppPackageVersion>3.0.0-preview-27324-5</MicrosoftNETCoreAppPackageVersion>
<MicrosoftExtensionsWebEncodersPackageVersion>3.0.0-alpha1-10717</MicrosoftExtensionsWebEncodersPackageVersion>
<MicrosoftNETCoreApp21PackageVersion>2.1.3</MicrosoftNETCoreApp21PackageVersion> <MicrosoftNETCoreApp21PackageVersion>2.1.3</MicrosoftNETCoreApp21PackageVersion>
<MicrosoftNETCoreApp30PackageVersion>3.0.0-preview-27113-06</MicrosoftNETCoreApp30PackageVersion> <MicrosoftNETCoreApp30PackageVersion>$(MicrosoftNETCoreAppPackageVersion)</MicrosoftNETCoreApp30PackageVersion>
<MicrosoftNETFrameworkReferenceAssemblies>1.0.0-alpha-004</MicrosoftNETFrameworkReferenceAssemblies> <MicrosoftNETFrameworkReferenceAssemblies>1.0.0-alpha-004</MicrosoftNETFrameworkReferenceAssemblies>
<MicrosoftNetRoslynDiagnosticsPackageVersion>2.6.2</MicrosoftNetRoslynDiagnosticsPackageVersion> <MicrosoftNetRoslynDiagnosticsPackageVersion>2.6.2</MicrosoftNetRoslynDiagnosticsPackageVersion>
<MicrosoftVisualStudioComponentModelHostPackageVersion>16.0.189-g83e7c53a57</MicrosoftVisualStudioComponentModelHostPackageVersion> <MicrosoftVisualStudioComponentModelHostPackageVersion>16.0.189-g83e7c53a57</MicrosoftVisualStudioComponentModelHostPackageVersion>
@ -94,9 +92,8 @@
<VSMAC_NewtonsoftJsonPackageVersion>10.0.3</VSMAC_NewtonsoftJsonPackageVersion> <VSMAC_NewtonsoftJsonPackageVersion>10.0.3</VSMAC_NewtonsoftJsonPackageVersion>
<TEST_NewtonsoftJsonPackageVersion>11.0.1</TEST_NewtonsoftJsonPackageVersion> <TEST_NewtonsoftJsonPackageVersion>11.0.1</TEST_NewtonsoftJsonPackageVersion>
<StreamJsonRpcPackageVersion>1.3.23</StreamJsonRpcPackageVersion> <StreamJsonRpcPackageVersion>1.3.23</StreamJsonRpcPackageVersion>
<SystemDiagnosticsDiagnosticSourcePackageVersion>4.6.0-preview1-26907-04</SystemDiagnosticsDiagnosticSourcePackageVersion> <SystemDiagnosticsDiagnosticSourcePackageVersion>4.6.0-preview.19073.11</SystemDiagnosticsDiagnosticSourcePackageVersion>
<SystemRuntimeInteropServicesRuntimeInformationPackageVersion>4.3.0</SystemRuntimeInteropServicesRuntimeInformationPackageVersion> <SystemTextEncodingsWebPackageVersion>4.6.0-preview.19073.11</SystemTextEncodingsWebPackageVersion>
<SystemValueTuplePackageVersion>4.6.0-preview1-26829-04</SystemValueTuplePackageVersion>
<VSIX_MicrosoftCodeAnalysisPackageVersion>3.0.0-beta2-18612-05</VSIX_MicrosoftCodeAnalysisPackageVersion> <VSIX_MicrosoftCodeAnalysisPackageVersion>3.0.0-beta2-18612-05</VSIX_MicrosoftCodeAnalysisPackageVersion>
<VSIX_MicrosoftCodeAnalysisCommonPackageVersion>3.0.0-beta2-18612-05</VSIX_MicrosoftCodeAnalysisCommonPackageVersion> <VSIX_MicrosoftCodeAnalysisCommonPackageVersion>3.0.0-beta2-18612-05</VSIX_MicrosoftCodeAnalysisCommonPackageVersion>
<VSIX_MicrosoftCodeAnalysisCSharpFeaturesPackageVersion>3.0.0-beta2-18612-05</VSIX_MicrosoftCodeAnalysisCSharpFeaturesPackageVersion> <VSIX_MicrosoftCodeAnalysisCSharpFeaturesPackageVersion>3.0.0-beta2-18612-05</VSIX_MicrosoftCodeAnalysisCSharpFeaturesPackageVersion>

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

@ -12,7 +12,6 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="MonoDevelop.Sdk" Version="$(MonoDevelopSdkPackageVersion)" /> <PackageReference Include="MonoDevelop.Sdk" Version="$(MonoDevelopSdkPackageVersion)" />
<PackageReference Include="Newtonsoft.Json" Version="$(VSMAC_NewtonsoftJsonPackageVersion)" /> <PackageReference Include="Newtonsoft.Json" Version="$(VSMAC_NewtonsoftJsonPackageVersion)" />
<PackageReference Include="System.ValueTuple" Version="$(SystemValueTuplePackageVersion)" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

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

@ -5,9 +5,9 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Html.Abstractions" Version="$(MicrosoftAspNetCoreHtmlAbstractionsPackageVersion)" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourcePackageVersion)" /> <PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourcePackageVersion)" />
<PackageReference Include="System.Text.Encodings.Web" Version="$(SystemTextEncodingsWebPackageVersion)" />
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.ComponentShim\Microsoft.AspNetCore.Razor.Test.ComponentShim.csproj" /> <ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.ComponentShim\Microsoft.AspNetCore.Razor.Test.ComponentShim.csproj" />
</ItemGroup> </ItemGroup>

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

@ -0,0 +1,22 @@
// 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.IO;
using System.Text.Encodings.Web;
namespace Microsoft.AspNetCore.Html
{
/// <summary>
/// HTML content which can be written to a TextWriter.
/// </summary>
public interface IHtmlContent
{
/// <summary>
/// Writes the content by encoding it with the specified <paramref name="encoder"/>
/// to the specified <paramref name="writer"/>.
/// </summary>
/// <param name="writer">The <see cref="TextWriter"/> to which the content is written.</param>
/// <param name="encoder">The <see cref="HtmlEncoder"/> which encodes the content to be written.</param>
void WriteTo(TextWriter writer, HtmlEncoder encoder);
}
}

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

@ -0,0 +1,40 @@
// 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 Microsoft.AspNetCore.Html
{
/// <summary>
/// A builder for HTML content.
/// </summary>
public interface IHtmlContentBuilder : IHtmlContentContainer
{
/// <summary>
/// Appends an <see cref="IHtmlContent"/> instance.
/// </summary>
/// <param name="content">The <see cref="IHtmlContent"/> to append.</param>
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
IHtmlContentBuilder AppendHtml(IHtmlContent content);
/// <summary>
/// Appends a <see cref="string"/> value. The value is treated as unencoded as-provided, and will be HTML
/// encoded before writing to output.
/// </summary>
/// <param name="unencoded">The <see cref="string"/> to append.</param>
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
IHtmlContentBuilder Append(string unencoded);
/// <summary>
/// Appends an HTML encoded <see cref="string"/> value. The value is treated as HTML encoded as-provided, and
/// no further encoding will be performed.
/// </summary>
/// <param name="encoded">The HTML encoded <see cref="string"/> to append.</param>
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
IHtmlContentBuilder AppendHtml(string encoded);
/// <summary>
/// Clears the content.
/// </summary>
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
IHtmlContentBuilder Clear();
}
}

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

@ -0,0 +1,30 @@
// 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 Microsoft.AspNetCore.Html
{
/// <summary>
/// Defines a contract for <see cref="IHtmlContent"/> instances made up of several components which
/// can be copied into an <see cref="IHtmlContentBuilder"/>.
/// </summary>
public interface IHtmlContentContainer : IHtmlContent
{
/// <summary>
/// Copies the contained content of this <see cref="IHtmlContentContainer"/> into <paramref name="builder"/>.
/// </summary>
/// <param name="builder">The <see cref="IHtmlContentBuilder"/>.</param>
void CopyTo(IHtmlContentBuilder builder);
/// <summary>
/// <para>
/// Moves the contained content of this <see cref="IHtmlContentContainer"/> into <paramref name="builder"/>.
/// </para>
/// <para>
/// After <see cref="MoveTo"/> is called, this <see cref="IHtmlContentContainer"/> instance should be left
/// in an empty state.
/// </para>
/// </summary>
/// <param name="builder">The <see cref="IHtmlContentBuilder"/>.</param>
void MoveTo(IHtmlContentBuilder builder);
}
}

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

@ -30,7 +30,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
/// <returns>A reference to this instance after the set operation has completed.</returns> /// <returns>A reference to this instance after the set operation has completed.</returns>
public TagHelperContent SetHtmlContent(IHtmlContent htmlContent) public TagHelperContent SetHtmlContent(IHtmlContent htmlContent)
{ {
HtmlContentBuilderExtensions.SetHtmlContent(this, htmlContent);
return this; return this;
} }
@ -44,7 +43,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
/// <returns>A reference to this instance after the set operation has completed.</returns> /// <returns>A reference to this instance after the set operation has completed.</returns>
public TagHelperContent SetContent(string unencoded) public TagHelperContent SetContent(string unencoded)
{ {
HtmlContentBuilderExtensions.SetContent(this, unencoded);
return this; return this;
} }
@ -58,7 +56,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
/// <returns>A reference to this instance after the set operation has completed.</returns> /// <returns>A reference to this instance after the set operation has completed.</returns>
public TagHelperContent SetHtmlContent(string encoded) public TagHelperContent SetHtmlContent(string encoded)
{ {
HtmlContentBuilderExtensions.SetHtmlContent(this, encoded);
return this; return this;
} }
@ -96,7 +93,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
/// <returns>A reference to this instance after the append operation has completed.</returns> /// <returns>A reference to this instance after the append operation has completed.</returns>
public TagHelperContent AppendFormat(string format, params object[] args) public TagHelperContent AppendFormat(string format, params object[] args)
{ {
HtmlContentBuilderExtensions.AppendFormat(this, null, format, args);
return this; return this;
} }
@ -113,7 +109,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
/// <returns>A reference to this instance after the append operation has completed.</returns> /// <returns>A reference to this instance after the append operation has completed.</returns>
public TagHelperContent AppendFormat(IFormatProvider provider, string format, params object[] args) public TagHelperContent AppendFormat(IFormatProvider provider, string format, params object[] args)
{ {
HtmlContentBuilderExtensions.AppendFormat(this, provider, format, args);
return this; return this;
} }

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

@ -6,8 +6,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Html.Abstractions" Version="$(MicrosoftAspNetCoreHtmlAbstractionsPackageVersion)" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourcePackageVersion)" /> <PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourcePackageVersion)" />
<PackageReference Include="System.Text.Encodings.Web" Version="$(SystemTextEncodingsWebPackageVersion)" />
</ItemGroup> </ItemGroup>
</Project> </Project>

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

@ -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.IO;
using System.Text.Encodings.Web;
namespace Microsoft.AspNetCore.Html
{
/// <summary>
/// An <see cref="IHtmlContent"/> implementation that wraps an HTML encoded <see cref="string"/>.
/// </summary>
public class HtmlString : IHtmlContent
{
/// <summary>
/// An <see cref="HtmlString"/> instance for <see cref="Environment.NewLine"/>.
/// </summary>
public static readonly HtmlString NewLine = new HtmlString(Environment.NewLine);
/// <summary>
/// An <see cref="HtmlString"/> instance for <see cref="string.Empty"/>.
/// </summary>
public static readonly HtmlString Empty = new HtmlString(string.Empty);
/// <summary>
/// Creates a new <see cref="HtmlString"/>.
/// </summary>
/// <param name="value">The HTML encoded value.</param>
public HtmlString(string value)
{
Value = value;
}
/// <summary>
/// Gets the HTML encoded value.
/// </summary>
public string Value { get; }
/// <inheritdoc />
public void WriteTo(TextWriter writer, HtmlEncoder encoder)
{
if (writer == null)
{
throw new ArgumentNullException(nameof(writer));
}
if (encoder == null)
{
throw new ArgumentNullException(nameof(encoder));
}
writer.Write(Value);
}
/// <inheritdoc />
public override string ToString()
{
return Value ?? string.Empty;
}
}
}

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

@ -0,0 +1,22 @@
// 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.IO;
using System.Text.Encodings.Web;
namespace Microsoft.AspNetCore.Html
{
/// <summary>
/// HTML content which can be written to a TextWriter.
/// </summary>
public interface IHtmlContent
{
/// <summary>
/// Writes the content by encoding it with the specified <paramref name="encoder"/>
/// to the specified <paramref name="writer"/>.
/// </summary>
/// <param name="writer">The <see cref="TextWriter"/> to which the content is written.</param>
/// <param name="encoder">The <see cref="HtmlEncoder"/> which encodes the content to be written.</param>
void WriteTo(TextWriter writer, HtmlEncoder encoder);
}
}

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

@ -0,0 +1,40 @@
// 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 Microsoft.AspNetCore.Html
{
/// <summary>
/// A builder for HTML content.
/// </summary>
public interface IHtmlContentBuilder : IHtmlContentContainer
{
/// <summary>
/// Appends an <see cref="IHtmlContent"/> instance.
/// </summary>
/// <param name="content">The <see cref="IHtmlContent"/> to append.</param>
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
IHtmlContentBuilder AppendHtml(IHtmlContent content);
/// <summary>
/// Appends a <see cref="string"/> value. The value is treated as unencoded as-provided, and will be HTML
/// encoded before writing to output.
/// </summary>
/// <param name="unencoded">The <see cref="string"/> to append.</param>
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
IHtmlContentBuilder Append(string unencoded);
/// <summary>
/// Appends an HTML encoded <see cref="string"/> value. The value is treated as HTML encoded as-provided, and
/// no further encoding will be performed.
/// </summary>
/// <param name="encoded">The HTML encoded <see cref="string"/> to append.</param>
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
IHtmlContentBuilder AppendHtml(string encoded);
/// <summary>
/// Clears the content.
/// </summary>
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
IHtmlContentBuilder Clear();
}
}

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

@ -0,0 +1,30 @@
// 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 Microsoft.AspNetCore.Html
{
/// <summary>
/// Defines a contract for <see cref="IHtmlContent"/> instances made up of several components which
/// can be copied into an <see cref="IHtmlContentBuilder"/>.
/// </summary>
public interface IHtmlContentContainer : IHtmlContent
{
/// <summary>
/// Copies the contained content of this <see cref="IHtmlContentContainer"/> into <paramref name="builder"/>.
/// </summary>
/// <param name="builder">The <see cref="IHtmlContentBuilder"/>.</param>
void CopyTo(IHtmlContentBuilder builder);
/// <summary>
/// <para>
/// Moves the contained content of this <see cref="IHtmlContentContainer"/> into <paramref name="builder"/>.
/// </para>
/// <para>
/// After <see cref="MoveTo"/> is called, this <see cref="IHtmlContentContainer"/> instance should be left
/// in an empty state.
/// </para>
/// </summary>
/// <param name="builder">The <see cref="IHtmlContentBuilder"/>.</param>
void MoveTo(IHtmlContentBuilder builder);
}
}

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

@ -30,7 +30,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
/// <returns>A reference to this instance after the set operation has completed.</returns> /// <returns>A reference to this instance after the set operation has completed.</returns>
public TagHelperContent SetHtmlContent(IHtmlContent htmlContent) public TagHelperContent SetHtmlContent(IHtmlContent htmlContent)
{ {
HtmlContentBuilderExtensions.SetHtmlContent(this, htmlContent);
return this; return this;
} }
@ -44,7 +43,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
/// <returns>A reference to this instance after the set operation has completed.</returns> /// <returns>A reference to this instance after the set operation has completed.</returns>
public TagHelperContent SetContent(string unencoded) public TagHelperContent SetContent(string unencoded)
{ {
HtmlContentBuilderExtensions.SetContent(this, unencoded);
return this; return this;
} }
@ -58,7 +56,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
/// <returns>A reference to this instance after the set operation has completed.</returns> /// <returns>A reference to this instance after the set operation has completed.</returns>
public TagHelperContent SetHtmlContent(string encoded) public TagHelperContent SetHtmlContent(string encoded)
{ {
HtmlContentBuilderExtensions.SetHtmlContent(this, encoded);
return this; return this;
} }
@ -96,7 +93,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
/// <returns>A reference to this instance after the append operation has completed.</returns> /// <returns>A reference to this instance after the append operation has completed.</returns>
public TagHelperContent AppendFormat(string format, params object[] args) public TagHelperContent AppendFormat(string format, params object[] args)
{ {
HtmlContentBuilderExtensions.AppendFormat(this, null, format, args);
return this; return this;
} }
@ -113,7 +109,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
/// <returns>A reference to this instance after the append operation has completed.</returns> /// <returns>A reference to this instance after the append operation has completed.</returns>
public TagHelperContent AppendFormat(IFormatProvider provider, string format, params object[] args) public TagHelperContent AppendFormat(IFormatProvider provider, string format, params object[] args)
{ {
HtmlContentBuilderExtensions.AppendFormat(this, provider, format, args);
return this; return this;
} }

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

@ -6,8 +6,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Html.Abstractions" Version="$(MicrosoftAspNetCoreHtmlAbstractionsPackageVersion)" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourcePackageVersion)" /> <PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourcePackageVersion)" />
<PackageReference Include="System.Text.Encodings.Web" Version="$(SystemTextEncodingsWebPackageVersion)" />
</ItemGroup> </ItemGroup>
</Project> </Project>

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

@ -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.IO;
using System.Text.Encodings.Web;
namespace Microsoft.AspNetCore.Html
{
/// <summary>
/// An <see cref="IHtmlContent"/> implementation that wraps an HTML encoded <see cref="string"/>.
/// </summary>
public class HtmlString : IHtmlContent
{
/// <summary>
/// An <see cref="HtmlString"/> instance for <see cref="Environment.NewLine"/>.
/// </summary>
public static readonly HtmlString NewLine = new HtmlString(Environment.NewLine);
/// <summary>
/// An <see cref="HtmlString"/> instance for <see cref="string.Empty"/>.
/// </summary>
public static readonly HtmlString Empty = new HtmlString(string.Empty);
/// <summary>
/// Creates a new <see cref="HtmlString"/>.
/// </summary>
/// <param name="value">The HTML encoded value.</param>
public HtmlString(string value)
{
Value = value;
}
/// <summary>
/// Gets the HTML encoded value.
/// </summary>
public string Value { get; }
/// <inheritdoc />
public void WriteTo(TextWriter writer, HtmlEncoder encoder)
{
if (writer == null)
{
throw new ArgumentNullException(nameof(writer));
}
if (encoder == null)
{
throw new ArgumentNullException(nameof(encoder));
}
writer.Write(Value);
}
/// <inheritdoc />
public override string ToString()
{
return Value ?? string.Empty;
}
}
}

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

@ -0,0 +1,22 @@
// 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.IO;
using System.Text.Encodings.Web;
namespace Microsoft.AspNetCore.Html
{
/// <summary>
/// HTML content which can be written to a TextWriter.
/// </summary>
public interface IHtmlContent
{
/// <summary>
/// Writes the content by encoding it with the specified <paramref name="encoder"/>
/// to the specified <paramref name="writer"/>.
/// </summary>
/// <param name="writer">The <see cref="TextWriter"/> to which the content is written.</param>
/// <param name="encoder">The <see cref="HtmlEncoder"/> which encodes the content to be written.</param>
void WriteTo(TextWriter writer, HtmlEncoder encoder);
}
}

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

@ -0,0 +1,40 @@
// 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 Microsoft.AspNetCore.Html
{
/// <summary>
/// A builder for HTML content.
/// </summary>
public interface IHtmlContentBuilder : IHtmlContentContainer
{
/// <summary>
/// Appends an <see cref="IHtmlContent"/> instance.
/// </summary>
/// <param name="content">The <see cref="IHtmlContent"/> to append.</param>
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
IHtmlContentBuilder AppendHtml(IHtmlContent content);
/// <summary>
/// Appends a <see cref="string"/> value. The value is treated as unencoded as-provided, and will be HTML
/// encoded before writing to output.
/// </summary>
/// <param name="unencoded">The <see cref="string"/> to append.</param>
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
IHtmlContentBuilder Append(string unencoded);
/// <summary>
/// Appends an HTML encoded <see cref="string"/> value. The value is treated as HTML encoded as-provided, and
/// no further encoding will be performed.
/// </summary>
/// <param name="encoded">The HTML encoded <see cref="string"/> to append.</param>
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
IHtmlContentBuilder AppendHtml(string encoded);
/// <summary>
/// Clears the content.
/// </summary>
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
IHtmlContentBuilder Clear();
}
}

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

@ -0,0 +1,30 @@
// 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 Microsoft.AspNetCore.Html
{
/// <summary>
/// Defines a contract for <see cref="IHtmlContent"/> instances made up of several components which
/// can be copied into an <see cref="IHtmlContentBuilder"/>.
/// </summary>
public interface IHtmlContentContainer : IHtmlContent
{
/// <summary>
/// Copies the contained content of this <see cref="IHtmlContentContainer"/> into <paramref name="builder"/>.
/// </summary>
/// <param name="builder">The <see cref="IHtmlContentBuilder"/>.</param>
void CopyTo(IHtmlContentBuilder builder);
/// <summary>
/// <para>
/// Moves the contained content of this <see cref="IHtmlContentContainer"/> into <paramref name="builder"/>.
/// </para>
/// <para>
/// After <see cref="MoveTo"/> is called, this <see cref="IHtmlContentContainer"/> instance should be left
/// in an empty state.
/// </para>
/// </summary>
/// <param name="builder">The <see cref="IHtmlContentBuilder"/>.</param>
void MoveTo(IHtmlContentBuilder builder);
}
}

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

@ -30,7 +30,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
/// <returns>A reference to this instance after the set operation has completed.</returns> /// <returns>A reference to this instance after the set operation has completed.</returns>
public TagHelperContent SetHtmlContent(IHtmlContent htmlContent) public TagHelperContent SetHtmlContent(IHtmlContent htmlContent)
{ {
HtmlContentBuilderExtensions.SetHtmlContent(this, htmlContent);
return this; return this;
} }
@ -44,7 +43,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
/// <returns>A reference to this instance after the set operation has completed.</returns> /// <returns>A reference to this instance after the set operation has completed.</returns>
public TagHelperContent SetContent(string unencoded) public TagHelperContent SetContent(string unencoded)
{ {
HtmlContentBuilderExtensions.SetContent(this, unencoded);
return this; return this;
} }
@ -58,7 +56,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
/// <returns>A reference to this instance after the set operation has completed.</returns> /// <returns>A reference to this instance after the set operation has completed.</returns>
public TagHelperContent SetHtmlContent(string encoded) public TagHelperContent SetHtmlContent(string encoded)
{ {
HtmlContentBuilderExtensions.SetHtmlContent(this, encoded);
return this; return this;
} }
@ -96,7 +93,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
/// <returns>A reference to this instance after the append operation has completed.</returns> /// <returns>A reference to this instance after the append operation has completed.</returns>
public TagHelperContent AppendFormat(string format, params object[] args) public TagHelperContent AppendFormat(string format, params object[] args)
{ {
HtmlContentBuilderExtensions.AppendFormat(this, null, format, args);
return this; return this;
} }
@ -113,7 +109,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
/// <returns>A reference to this instance after the append operation has completed.</returns> /// <returns>A reference to this instance after the append operation has completed.</returns>
public TagHelperContent AppendFormat(IFormatProvider provider, string format, params object[] args) public TagHelperContent AppendFormat(IFormatProvider provider, string format, params object[] args)
{ {
HtmlContentBuilderExtensions.AppendFormat(this, provider, format, args);
return this; return this;
} }

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

@ -6,9 +6,9 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Html.Abstractions" Version="$(MicrosoftAspNetCoreHtmlAbstractionsPackageVersion)" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourcePackageVersion)" /> <PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourcePackageVersion)" />
<PackageReference Include="System.Text.Encodings.Web" Version="$(SystemTextEncodingsWebPackageVersion)" />
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.ComponentShim\Microsoft.AspNetCore.Razor.Test.ComponentShim.csproj" /> <ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.ComponentShim\Microsoft.AspNetCore.Razor.Test.ComponentShim.csproj" />
</ItemGroup> </ItemGroup>

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

@ -245,12 +245,13 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
Assert.FileExists(result, OutputPath, "SimpleMvc.deps.json"); Assert.FileExists(result, OutputPath, "SimpleMvc.deps.json");
var depsFilePath = Path.Combine(Project.DirectoryPath, OutputPath, "SimpleMvc.deps.json"); var depsFilePath = Path.Combine(Project.DirectoryPath, OutputPath, "SimpleMvc.deps.json");
var dependencyContext = ReadDependencyContext(depsFilePath); var dependencyContext = ReadDependencyContext(depsFilePath);
// Pick a couple of libraries and ensure they have some compile references // Pick a couple of libraries and ensure they have some compile references
var packageReference = dependencyContext.CompileLibraries.First(l => l.Name == "Microsoft.AspNetCore.Html.Abstractions"); var packageReference = dependencyContext.CompileLibraries.First(l => l.Name == "Microsoft.NETCore.App");
Assert.NotEmpty(packageReference.Assemblies); Assert.NotEmpty(packageReference.Assemblies);
var projectReference = dependencyContext.CompileLibraries.First(l => l.Name == "SimpleMvc"); var projectReference = dependencyContext.CompileLibraries.First(l => l.Name == "SimpleMvc");
Assert.NotEmpty(packageReference.Assemblies); Assert.NotEmpty(projectReference.Assemblies);
Assert.Contains(customDefine, dependencyContext.CompilationOptions.Defines); Assert.Contains(customDefine, dependencyContext.CompilationOptions.Defines);
} }

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

@ -29,7 +29,6 @@
<!-- The test projects rely on these binaries being available --> <!-- The test projects rely on these binaries being available -->
<ItemGroup> <ItemGroup>
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourcePackageVersion)" /> <PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourcePackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Html.Abstractions" Version="$(MicrosoftAspNetCoreHtmlAbstractionsPackageVersion)" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

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

@ -27,7 +27,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(BinariesRoot)'!=''"> <ItemGroup Condition="'$(BinariesRoot)'!=''">
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Html.Abstractions.dll"/>
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/> <Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/> <Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/>
</ItemGroup> </ItemGroup>

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

@ -30,7 +30,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(BinariesRoot)'!=''"> <ItemGroup Condition="'$(BinariesRoot)'!=''">
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Html.Abstractions.dll"/>
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/> <Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/> <Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/>
</ItemGroup> </ItemGroup>

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

@ -27,7 +27,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(BinariesRoot)'!=''"> <ItemGroup Condition="'$(BinariesRoot)'!=''">
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Html.Abstractions.dll"/>
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/> <Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/> <Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/>
</ItemGroup> </ItemGroup>

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

@ -24,7 +24,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(BinariesRoot)'!=''"> <ItemGroup Condition="'$(BinariesRoot)'!=''">
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Html.Abstractions.dll"/>
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/> <Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/> <Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/>
</ItemGroup> </ItemGroup>

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

@ -25,7 +25,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(BinariesRoot)'!=''"> <ItemGroup Condition="'$(BinariesRoot)'!=''">
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Html.Abstractions.dll"/>
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/> <Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/> <Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/>
</ItemGroup> </ItemGroup>

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

@ -24,7 +24,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(BinariesRoot)'!=''"> <ItemGroup Condition="'$(BinariesRoot)'!=''">
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Html.Abstractions.dll"/>
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/> <Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/> <Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/>
</ItemGroup> </ItemGroup>

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

@ -29,7 +29,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(BinariesRoot)'!=''"> <ItemGroup Condition="'$(BinariesRoot)'!=''">
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Html.Abstractions.dll"/>
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/> <Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/> <Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/>
</ItemGroup> </ItemGroup>

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

@ -24,7 +24,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(BinariesRoot)'!=''"> <ItemGroup Condition="'$(BinariesRoot)'!=''">
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Html.Abstractions.dll"/>
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/> <Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/> <Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/>
</ItemGroup> </ItemGroup>