Make RazorCompileOnPublish the default

This commit is contained in:
Ryan Nowak 2018-01-16 20:06:16 -08:00
parent 627696677c
commit 0584fe3ecf
3 changed files with 30 additions and 2 deletions

View File

@ -8,8 +8,8 @@
configure this behaviour.
-->
<PropertyGroup>
<RazorCompileOnBuild Condition="'$(RazorCompileOnBuild)'==''">false</RazorCompileOnBuild>
<RazorCompileOnPublish Condition="'$(RazorCompileOnPublish)'==''">false</RazorCompileOnPublish>
<RazorGenerateDependsOn>RazorResolveGenerateInputs;RazorCoreGenerate</RazorGenerateDependsOn>
<RazorCompileDependsOn>RazorGenerate;RazorCoreCompile</RazorCompileDependsOn>
</PropertyGroup>
<PropertyGroup>

View File

@ -45,6 +45,13 @@
Default values for properties that affect Razor MSBuild behavior.
-->
<PropertyGroup>
<!--
Razor also attaches itself by default to some of the standard .NET targets. Uses these properties to
configure this behaviour.
-->
<RazorCompileOnBuild Condition="'$(RazorCompileOnBuild)'==''">false</RazorCompileOnBuild>
<RazorCompileOnPublish Condition="'$(RazorCompileOnPublish)'==''">true</RazorCompileOnPublish>
<!-- Output directory used for generated files -->
<RazorGenerateOutputPath Condition="'$(RazorGenerateOutputPath)'==''">$(IntermediateOutputPath)Razor\</RazorGenerateOutputPath>

View File

@ -9,6 +9,27 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
{
public class PublishIntegrationTest : MSBuildIntegrationTestBase
{
[Fact]
[InitializeTestProject("SimpleMvc")]
public async Task Publish_RazorCompileOnPublish_IsDefault()
{
var result = await DotnetMSBuild("Publish");
Assert.BuildPassed(result);
Assert.FileDoesNotExist(result, OutputPath, "SimpleMvc.PrecompiledViews.dll");
Assert.FileDoesNotExist(result, OutputPath, "SimpleMvc.PrecompiledViews.pdb");
Assert.FileExists(result, PublishOutputPath, "SimpleMvc.dll");
Assert.FileExists(result, PublishOutputPath, "SimpleMvc.pdb");
Assert.FileExists(result, PublishOutputPath, "SimpleMvc.PrecompiledViews.dll");
Assert.FileExists(result, PublishOutputPath, "SimpleMvc.PrecompiledViews.pdb");
// By default refs and .cshtml files will not be copied on publish
Assert.FileCountEquals(result, 0, Path.Combine(PublishOutputPath, "refs"), "*.dll");
Assert.FileCountEquals(result, 0, Path.Combine(PublishOutputPath, "Views"), "*.cshtml");
}
[Fact]
[InitializeTestProject("SimpleMvc")]
public async Task Publish_WithRazorCompileOnBuild_PublishesAssembly()