diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.DesignTime.targets b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.DesignTime.targets
index cfb0e4e046..bd66729778 100644
--- a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.DesignTime.targets
+++ b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.DesignTime.targets
@@ -52,9 +52,15 @@ Copyright (c) .NET Foundation. All rights reserved.
Project
+
+ Project
+
-
+
diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Rules/RazorComponentWithTargetPath.xaml b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Rules/RazorComponentWithTargetPath.xaml
new file mode 100644
index 0000000000..14a479afe3
--- /dev/null
+++ b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Rules/RazorComponentWithTargetPath.xaml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.props b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.props
index 673a61d3da..71100e6541 100644
--- a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.props
+++ b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.props
@@ -68,11 +68,6 @@ Copyright (c) .NET Foundation. All rights reserved.
-->
.g.cs
-
- .g.i.cs
-
true
diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/DesignTimeBuildIntegrationTest.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/DesignTimeBuildIntegrationTest.cs
index 6514e73057..7d5f88d9fb 100644
--- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/DesignTimeBuildIntegrationTest.cs
+++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/DesignTimeBuildIntegrationTest.cs
@@ -64,5 +64,29 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
$@"RazorGenerateWithTargetPath: {filePath} {filePath} {Path.Combine(RazorIntermediateOutputPath, filePath + ".g.cs")}");
}
}
+
+ [Fact]
+ [InitializeTestProject("ComponentLibrary")]
+ public async Task RazorGenerateDesignTime_ReturnsRazorComponentWithTargetPath()
+ {
+ TargetFramework = "netstandard2.0";
+
+ var result = await DotnetMSBuild("RazorGenerateDesignTime;_IntrospectRazorComponentWithTargetPath");
+
+ Assert.BuildPassed(result);
+
+ var filePaths = new string[]
+ {
+ Path.Combine("MyComponent.cshtml"),
+ Path.Combine("GenericComponent.razor"),
+ };
+
+ foreach (var filePath in filePaths)
+ {
+ Assert.BuildOutputContainsLine(
+ result,
+ $@"RazorComponentWithTargetPath: {filePath} {filePath} {Path.Combine(RazorIntermediateOutputPath, filePath + ".g.cs")} {Path.Combine(RazorComponentIntermediateOutputPath, filePath + ".g.cs")}");
+ }
+ }
}
}
diff --git a/src/Razor/test/testassets/RazorTest.Introspection.targets b/src/Razor/test/testassets/RazorTest.Introspection.targets
index f0e8f860ab..b3e93737f3 100644
--- a/src/Razor/test/testassets/RazorTest.Introspection.targets
+++ b/src/Razor/test/testassets/RazorTest.Introspection.targets
@@ -3,6 +3,10 @@
+
+
+
+