Add RazorGenerate items to UpToDateCheckInput

Fixes #2048
This commit is contained in:
Pranav K 2018-02-27 10:30:45 -08:00
parent 2958a145e3
commit f51ddf68a6
3 changed files with 29 additions and 0 deletions

View File

@ -158,6 +158,8 @@ Copyright (c) .NET Foundation. All rights reserved.
<RazorIntermediateAssembly Condition="'$(RazorIntermediateAssembly)'==''" Include="$(IntermediateOutputPath)$(RazorTargetName).dll" />
<!-- Used in Compilation.targets -->
<_RazorDebugSymbolsIntermediatePath Condition="'$(_RazorDebugSymbolsProduced)'=='true'" Include="$(IntermediateOutputPath)$(RazorTargetName).pdb" />
<!-- Add all cshtml files to UpToDateCheckInput - a collection used by the IDE's project system to determine if a project needs to be rebuilt -->
<UpToDateCheckInput Condition="'$(RazorCompileOnBuild)'=='true'" Include="@(Content->WithMetadataValue('Extension', '.cshtml'))" />
</ItemGroup>
<!--

View File

@ -0,0 +1,23 @@
// 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;
namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
{
public class BuildIntrospectionTest : MSBuildIntegrationTestBase
{
[Fact]
[InitializeTestProject("SimpleMvc")]
public async Task RazorSdk_AddsCshtmlFilesToUpToDateCheckInput()
{
var result = await DotnetMSBuild("_IntrospectUpToDateCheckInput", "/p:RazorCompileOnBuild=true");
Assert.BuildPassed(result);
Assert.BuildOutputContainsLine(result, $"UpToDateCheckInput: {Path.Combine("Views", "Home", "Index.cshtml")}");
Assert.BuildOutputContainsLine(result, $"UpToDateCheckInput: {Path.Combine("Views", "_ViewStart.cshtml")}");
}
}
}

View File

@ -10,4 +10,8 @@
<Target Name="_IntrospectPreserveCompilationContext">
<Message Text="PreserveCompilationContext: $(PreserveCompilationContext)" Importance="High" />
</Target>
<Target Name="_IntrospectUpToDateCheckInput">
<Message Text="UpToDateCheckInput: %(UpToDateCheckInput.Identity)" Importance="High" />
</Target>
</Project>