diff --git a/Blazor.sln b/Blazor.sln
index 3879ae4e02..fb2d08ecfe 100644
--- a/Blazor.sln
+++ b/Blazor.sln
@@ -54,11 +54,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Blazor.Browser.JS
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Blazor.Browser", "src\Microsoft.Blazor.Browser\Microsoft.Blazor.Browser.csproj", "{4874AFF4-335D-4037-8858-BBBB987C124B}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Blazor.Test", "test\Microsoft.Blazor.Test\Microsoft.Blazor.Test.csproj", "{8FD8636E-AFA5-434D-8857-06D02686741A}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Blazor.Test", "test\Microsoft.Blazor.Test\Microsoft.Blazor.Test.csproj", "{8FD8636E-AFA5-434D-8857-06D02686741A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "testapps", "testapps", "{4AE0D35B-D97A-44D0-8392-C9240377DCCE}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasicTestApp", "test\testapps\BasicTestApp\BasicTestApp.csproj", "{2838CB6F-D2C7-4C0A-A994-C72E56F16984}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BasicTestApp", "test\testapps\BasicTestApp\BasicTestApp.csproj", "{2838CB6F-D2C7-4C0A-A994-C72E56F16984}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "anglesharp", "anglesharp", "{4E3BD19A-6159-4548-A88F-700443E6D934}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AngleSharpBuilder", "src\anglesharp\AngleSharpBuilder\AngleSharpBuilder.csproj", "{36706AC2-C851-4038-B161-9C1E44B668C8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -146,6 +150,10 @@ Global
{2838CB6F-D2C7-4C0A-A994-C72E56F16984}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2838CB6F-D2C7-4C0A-A994-C72E56F16984}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2838CB6F-D2C7-4C0A-A994-C72E56F16984}.Release|Any CPU.Build.0 = Release|Any CPU
+ {36706AC2-C851-4038-B161-9C1E44B668C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {36706AC2-C851-4038-B161-9C1E44B668C8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {36706AC2-C851-4038-B161-9C1E44B668C8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {36706AC2-C851-4038-B161-9C1E44B668C8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -175,6 +183,8 @@ Global
{8FD8636E-AFA5-434D-8857-06D02686741A} = {ADA3AE29-F6DE-49F6-8C7C-B321508CAE8E}
{4AE0D35B-D97A-44D0-8392-C9240377DCCE} = {ADA3AE29-F6DE-49F6-8C7C-B321508CAE8E}
{2838CB6F-D2C7-4C0A-A994-C72E56F16984} = {4AE0D35B-D97A-44D0-8392-C9240377DCCE}
+ {4E3BD19A-6159-4548-A88F-700443E6D934} = {B867E038-B3CE-43E3-9292-61568C46CDEB}
+ {36706AC2-C851-4038-B161-9C1E44B668C8} = {4E3BD19A-6159-4548-A88F-700443E6D934}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {504DA352-6788-4DC0-8705-82167E72A4D3}
diff --git a/src/Microsoft.Blazor.Build/Microsoft.Blazor.Build.csproj b/src/Microsoft.Blazor.Build/Microsoft.Blazor.Build.csproj
index 5a5c65e271..9b0714136a 100644
--- a/src/Microsoft.Blazor.Build/Microsoft.Blazor.Build.csproj
+++ b/src/Microsoft.Blazor.Build/Microsoft.Blazor.Build.csproj
@@ -31,4 +31,9 @@
+
+
+
+
+
diff --git a/src/anglesharp/AngleSharpBuilder/.gitignore b/src/anglesharp/AngleSharpBuilder/.gitignore
new file mode 100644
index 0000000000..849ddff3b7
--- /dev/null
+++ b/src/anglesharp/AngleSharpBuilder/.gitignore
@@ -0,0 +1 @@
+dist/
diff --git a/src/anglesharp/AngleSharpBuilder/AngleSharpBuilder.csproj b/src/anglesharp/AngleSharpBuilder/AngleSharpBuilder.csproj
new file mode 100644
index 0000000000..dca49b3219
--- /dev/null
+++ b/src/anglesharp/AngleSharpBuilder/AngleSharpBuilder.csproj
@@ -0,0 +1,17 @@
+
+
+
+ netcoreapp2.0
+ Exe
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/anglesharp/AngleSharpBuilder/Program.cs b/src/anglesharp/AngleSharpBuilder/Program.cs
new file mode 100644
index 0000000000..ad7a11e5f2
--- /dev/null
+++ b/src/anglesharp/AngleSharpBuilder/Program.cs
@@ -0,0 +1,54 @@
+// 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 AngleSharp.Parser.Html;
+using Mono.Cecil;
+using System.IO;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+namespace AngleSharpBuilder
+{
+ /*
+ * AngleSharp's HtmlTokenizer is perfect for the RazorCompiler use case of splitting up
+ * incomplete HTML strings into partial elements, attributes, etc. Unfortunately,
+ * AngleSharp does not expose HtmlTokenizer publicly.
+ *
+ * For now, we work around this by building a custom version of AngleSharp.dll that
+ * specifies [InternalsVisibleTo("Microsoft.Blazor.Build")]. Longer term we can ask
+ * AngleSharp to expose HtmlTokenizer as a public API, and if that's not viable, possibly
+ * replace AngleSharp with a different library for HTML tokenization.
+ */
+
+ public static class Program
+ {
+ public static void Main()
+ {
+ var outputDir = Path.Combine(Directory.GetCurrentDirectory(), "dist");
+ var angleSharpAssembly = Assembly.GetAssembly(typeof(HtmlParser));
+ WriteWithInternalsVisibleTo(
+ angleSharpAssembly,
+ "Microsoft.Blazor.Build",
+ outputDir);
+ }
+
+ private static void WriteWithInternalsVisibleTo(Assembly assembly, string internalVisibleToArg, string outputDir)
+ {
+ Directory.CreateDirectory(outputDir);
+
+ var assemblyLocation = assembly.Location;
+ var moduleDefinition = ModuleDefinition.ReadModule(assemblyLocation);
+
+ var internalsVisibleToCtor = moduleDefinition.ImportReference(
+ typeof(InternalsVisibleToAttribute).GetConstructor(new[] { typeof(string) }));
+
+ var customAttribute = new CustomAttribute(internalsVisibleToCtor);
+ customAttribute.ConstructorArguments.Add(
+ new CustomAttributeArgument(moduleDefinition.TypeSystem.String, internalVisibleToArg));
+
+ moduleDefinition.Assembly.CustomAttributes.Add(customAttribute);
+
+ moduleDefinition.Write(Path.Combine(outputDir, Path.GetFileName(assemblyLocation)));
+ }
+ }
+}
diff --git a/test/Microsoft.Blazor.Build.Test/Microsoft.Blazor.Build.Test.csproj b/test/Microsoft.Blazor.Build.Test/Microsoft.Blazor.Build.Test.csproj
index 60ad93da79..3f133c9bad 100644
--- a/test/Microsoft.Blazor.Build.Test/Microsoft.Blazor.Build.Test.csproj
+++ b/test/Microsoft.Blazor.Build.Test/Microsoft.Blazor.Build.Test.csproj
@@ -7,7 +7,7 @@
-
+