diff --git a/korebuild-lock.txt b/korebuild-lock.txt index c6125ba391..565ec4224a 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview2-15698 -commithash:7216e5068cb1957e09d45fcbe58a744dd5c2de73 +version:2.1.0-preview2-15704 +commithash:21fdd9f5254226f407a2b4b3ef963693c2fd7998 diff --git a/src/Microsoft.NET.Sdk.Razor/Sdk/Sdk.props b/src/Microsoft.NET.Sdk.Razor/Sdk/Sdk.props index b5fb8f7017..9102f6c805 100644 --- a/src/Microsoft.NET.Sdk.Razor/Sdk/Sdk.props +++ b/src/Microsoft.NET.Sdk.Razor/Sdk/Sdk.props @@ -10,6 +10,13 @@ Copyright (c) .NET Foundation. All rights reserved. *********************************************************************************************** --> + + + <_RazorSdkImportsMicrosoftNetSdk Condition="'$(UsingMicrosoftNETSdk)' != 'true'">true + + + + $(MSBuildThisFileDirectory)..\build\netstandard2.0\Sdk.Razor.CurrentVersion.props diff --git a/src/Microsoft.NET.Sdk.Razor/Sdk/Sdk.targets b/src/Microsoft.NET.Sdk.Razor/Sdk/Sdk.targets index c096a5cbf4..20b70fd9ab 100644 --- a/src/Microsoft.NET.Sdk.Razor/Sdk/Sdk.targets +++ b/src/Microsoft.NET.Sdk.Razor/Sdk/Sdk.targets @@ -11,6 +11,8 @@ Copyright (c) .NET Foundation. All rights reserved. --> + + $(MSBuildThisFileDirectory)..\buildMultiTargeting\Sdk.Razor.CurrentVersion.MultiTargeting.targets $(MSBuildThisFileDirectory)..\build\netstandard2.0\Sdk.Razor.CurrentVersion.targets diff --git a/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Sdk.Razor.CurrentVersion.props b/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Sdk.Razor.CurrentVersion.props index 8bd67bc624..0d9f2603ab 100644 --- a/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Sdk.Razor.CurrentVersion.props +++ b/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Sdk.Razor.CurrentVersion.props @@ -51,7 +51,7 @@ Copyright (c) .NET Foundation. All rights reserved. false - + diff --git a/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Sdk.Razor.CurrentVersion.targets b/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Sdk.Razor.CurrentVersion.targets index 2ea795e89b..c101bf26d2 100644 --- a/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Sdk.Razor.CurrentVersion.targets +++ b/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Sdk.Razor.CurrentVersion.targets @@ -57,6 +57,14 @@ Copyright (c) .NET Foundation. All rights reserved. PrepareForRazorCompile; RazorCoreCompile + + + + + + true - + PrecompilationTool diff --git a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/BuildIntegrationTest.cs b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/BuildIntegrationTest.cs index 30cbfd1b86..91655ff610 100644 --- a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/BuildIntegrationTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/BuildIntegrationTest.cs @@ -39,6 +39,11 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests // end up in the MSBuild logs. Assert.BuildOutputContainsLine(result, $"SimpleMvc -> {Path.Combine(Path.GetFullPath(Project.DirectoryPath), OutputPath, "SimpleMvc.PrecompiledViews.dll")}"); } + + result = await DotnetMSBuild("_IntrospectPreserveCompilationContext"); + + Assert.BuildPassed(result); + Assert.BuildOutputContainsLine(result, "PreserveCompilationContext: true"); } [Fact] @@ -54,6 +59,13 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests Assert.FileExists(result, OutputPath, "SimpleMvc.pdb"); Assert.FileDoesNotExist(result, OutputPath, "SimpleMvc.PrecompiledViews.dll"); Assert.FileDoesNotExist(result, OutputPath, "SimpleMvc.PrecompiledViews.pdb"); + + result = await DotnetMSBuild("_IntrospectPreserveCompilationContext"); + + Assert.BuildPassed(result); + // An app with no cshtml files should not have PreserveCompilationContext. + // This expectation should get resolved once we address https://github.com/aspnet/Razor/issues/2077 + Assert.BuildOutputContainsLine(result, "PreserveCompilationContext: true"); } [Fact] diff --git a/test/testapps/Directory.Build.props b/test/testapps/Directory.Build.props index 475a18a63f..134f59524c 100644 --- a/test/testapps/Directory.Build.props +++ b/test/testapps/Directory.Build.props @@ -4,6 +4,9 @@ $(MSBuildThisFileDirectory)..\..\ $([MSBuild]::EnsureTrailingSlash('$(SolutionRoot)')) + + + <_RazorSdkPackageReferenced>true diff --git a/test/testapps/RazorTest.Introspection.targets b/test/testapps/RazorTest.Introspection.targets index c950594f49..a909d0215b 100644 --- a/test/testapps/RazorTest.Introspection.targets +++ b/test/testapps/RazorTest.Introspection.targets @@ -6,4 +6,8 @@ + + + +