Fix build break

We didn't have a test for the case where RazorCompileOnPublish is false
and Publish is being called. This is breaking the precompilation repo.
This commit is contained in:
Ryan Nowak 2018-01-17 18:07:55 -08:00
parent d1cfc51c9d
commit eaa201703d
2 changed files with 20 additions and 2 deletions

View File

@ -162,14 +162,15 @@
</Target>
<!--
This target is called after PrepareForPublish when RazorCompileOnBuild=true so that we can hook into publish.
This target is called after PrepareForPublish when RazorCompileOnPublish=true so that we can hook into publish.
This target just hooks up other targets since Publish and PrepareForPublish don't have a DependsOnTargets
property we can use.
-->
<Target
Name="_RazorPrepareForPublish"
AfterTargets="PrepareForPublish"
DependsOnTargets="RazorCompile">
DependsOnTargets="RazorCompile"
Condition="'$(RazorCompileOnPublish)'=='true'">
</Target>
<!--

View File

@ -91,6 +91,23 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
Assert.FileDoesNotExist(result, PublishOutputPath, "SimpleMvc.PrecompiledViews.pdb");
}
[Fact]
[InitializeTestProject("SimpleMvc")]
public async Task Publish_NoopsWith_RazorCompileOnPublishFalse()
{
Directory.Delete(Path.Combine(Project.DirectoryPath, "Views"), recursive: true);
var result = await DotnetMSBuild("Publish", "/p:RazorCompileOnPublish=false");
Assert.BuildPassed(result);
// Everything we do should noop - including building the app.
Assert.FileExists(result, PublishOutputPath, "SimpleMvc.dll");
Assert.FileExists(result, PublishOutputPath, "SimpleMvc.pdb");
Assert.FileDoesNotExist(result, PublishOutputPath, "SimpleMvc.PrecompiledViews.dll");
Assert.FileDoesNotExist(result, PublishOutputPath, "SimpleMvc.PrecompiledViews.pdb");
}
[Fact]
[InitializeTestProject("SimpleMvc")]
public async Task Publish_SkipsCopyingBinariesToOutputDirectory_IfCopyBuildOutputToOutputDirectory_IsUnset()