diff --git a/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.DesignTime.targets b/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.DesignTime.targets index 0b012be77c..64c5d8f61a 100644 --- a/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.DesignTime.targets +++ b/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.DesignTime.targets @@ -45,4 +45,7 @@ Copyright (c) .NET Foundation. All rights reserved. + + + diff --git a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/DesignTimeBuildIntegrationTest.cs b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/DesignTimeBuildIntegrationTest.cs index 9fd41950e7..c8fce36363 100644 --- a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/DesignTimeBuildIntegrationTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/DesignTimeBuildIntegrationTest.cs @@ -1,6 +1,7 @@ // 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.Threading.Tasks; using Xunit; @@ -35,5 +36,33 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests Assert.DoesNotContain("RazorCoreGenerate", result.Output); Assert.DoesNotContain("RazorCoreCompile", result.Output); } + + [Fact] + [InitializeTestProject("SimpleMvc")] + public async Task RazorGenerateDesignTime_ReturnsRazorGenerateWithTargetPath() + { + var result = await DotnetMSBuild("RazorGenerateDesignTime;_IntrospectRazorGenerateWithTargetPath"); + + Assert.BuildPassed(result); + + var filePaths = new string[] + { + Path.Combine("Views", "Home", "About.cshtml"), + Path.Combine("Views", "Home", "Contact.cshtml"), + Path.Combine("Views", "Home", "Index.cshtml"), + Path.Combine("Views", "Shared", "Error.cshtml"), + Path.Combine("Views", "Shared", "_Layout.cshtml"), + Path.Combine("Views", "Shared", "_ValidationScriptsPartial.cshtml"), + Path.Combine("Views", "_ViewImports.cshtml"), + Path.Combine("Views", "_ViewStart.cshtml"), + }; + + foreach (var filePath in filePaths) + { + Assert.BuildOutputContainsLine( + result, + $@"RazorGenerateWithTargetPath: {filePath} {filePath} {Path.Combine(RazorIntermediateOutputPath, Path.ChangeExtension(filePath, ".g.cshtml.cs"))}"); + } + } } }