From b10374a368b7f590126019cd7c2844328f285cf2 Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Fri, 4 Jan 2019 11:17:40 -0800 Subject: [PATCH] SDK updates for components tooling This is a bug fix for the RazorComponentWithTargetPath xaml rule. We need to have separate targets for components and views. The other fix here is a change to the set of workarounds we're using for components currently. We need this project capability for the correct project host to be used when loading the project. (cherry picked from commit dotnet/aspnetcore-tooling@78163f7e4f38937831cea526d682c30aad7bf80c) \n\nCommit migrated from https://github.com/dotnet/aspnetcore-tooling/commit/f8835ce7a88b188ff397b1be1b06e8e3e75dc1d1 --- .../Microsoft.NET.Sdk.Razor.DesignTime.targets | 10 ++++++++-- .../Rules/RazorComponentWithTargetPath.xaml | 4 ++-- .../IntegrationTests/DesignTimeBuildIntegrationTest.cs | 4 ++-- .../ComponentLibrary/ComponentLibrary.csproj | 4 ++++ 4 files changed, 16 insertions(+), 6 deletions(-) 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 bd66729778..2a9f95d7e4 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 @@ -59,8 +59,14 @@ Copyright (c) .NET Foundation. All rights reserved. + DependsOnTargets="ResolveRazorGenerateInputs;AssignRazorGenerateTargetPaths" + Returns="@(RazorGenerateWithTargetPath)"> + + + 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 index 14a479afe3..668c85bd59 100644 --- 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 @@ -2,14 +2,14 @@ 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 7d5f88d9fb..c6b33539ad 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/DesignTimeBuildIntegrationTest.cs +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/DesignTimeBuildIntegrationTest.cs @@ -67,11 +67,11 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests [Fact] [InitializeTestProject("ComponentLibrary")] - public async Task RazorGenerateDesignTime_ReturnsRazorComponentWithTargetPath() + public async Task RazorGenerateComponentDesignTime_ReturnsRazorComponentWithTargetPath() { TargetFramework = "netstandard2.0"; - var result = await DotnetMSBuild("RazorGenerateDesignTime;_IntrospectRazorComponentWithTargetPath"); + var result = await DotnetMSBuild("RazorGenerateComponentDesignTime;_IntrospectRazorComponentWithTargetPath"); Assert.BuildPassed(result); diff --git a/src/Razor/test/testassets/ComponentLibrary/ComponentLibrary.csproj b/src/Razor/test/testassets/ComponentLibrary/ComponentLibrary.csproj index f3ad8532a3..631a4c0a46 100644 --- a/src/Razor/test/testassets/ComponentLibrary/ComponentLibrary.csproj +++ b/src/Razor/test/testassets/ComponentLibrary/ComponentLibrary.csproj @@ -42,6 +42,10 @@ + + + +