diff --git a/src/Microsoft.AspNetCore.Blazor.Build/targets/RazorCompilation.targets b/src/Microsoft.AspNetCore.Blazor.Build/targets/RazorCompilation.targets index 2d6896c5eb20db56a5e4b592d2b65312da717e07..fa40d6c86f99865b8bdc21f90e16aa37f2a5780c 100644 --- a/src/Microsoft.AspNetCore.Blazor.Build/targets/RazorCompilation.targets +++ b/src/Microsoft.AspNetCore.Blazor.Build/targets/RazorCompilation.targets @@ -14,6 +14,8 @@ <!-- Deactivates the Razor SDK's build-time compilation. We do our own --> <RazorCompileOnBuild>false</RazorCompileOnBuild> + <RazorLangVersion>Experimental</RazorLangVersion> + <!-- This version is used to build our RazorConfiguration, and is hardcoded into the tools in VS. If you change This to a value that doesn't match VS, then the Blazor Razor experience won't work for those documents. diff --git a/test/Microsoft.AspNetCore.Blazor.E2ETest/Tests/ComponentRenderingTest.cs b/test/Microsoft.AspNetCore.Blazor.E2ETest/Tests/ComponentRenderingTest.cs index 5b716e29fa8323b2d4254fa95f2d5dd08c39cb72..ef77b7cfee6388341a39e4bab849df21e446e998 100644 --- a/test/Microsoft.AspNetCore.Blazor.E2ETest/Tests/ComponentRenderingTest.cs +++ b/test/Microsoft.AspNetCore.Blazor.E2ETest/Tests/ComponentRenderingTest.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// 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; @@ -40,6 +40,17 @@ namespace Microsoft.AspNetCore.Blazor.E2ETest.Tests Assert.Equal("Hello from TextOnlyComponent", appElement.Text); } + // This verifies that we've correctly configured the Razor language version via MSBuild. + // See #974 + [Fact] + public void CanRenderComponentWithDataDash() + { + var appElement = MountTestComponent<DataDashComponent>(); + var element = appElement.FindElement(By.Id("cool_beans")); + Assert.Equal("17", element.GetAttribute("data-tab")); + Assert.Equal("17", element.Text); + } + [Fact] public void CanRenderComponentWithAttributes() { diff --git a/test/testapps/BasicTestApp/DataDashComponent.cshtml b/test/testapps/BasicTestApp/DataDashComponent.cshtml new file mode 100644 index 0000000000000000000000000000000000000000..ae00ab1bc92165817e7f14b5fd31e6604dd0e974 --- /dev/null +++ b/test/testapps/BasicTestApp/DataDashComponent.cshtml @@ -0,0 +1,5 @@ +<div id="cool_beans" data-tab="@TabId">@TabId</div> + +@functions { + string TabId = "17"; +}