File tree 2 files changed +23
-0
lines changed
src/Microsoft.AspNetCore.Razor.Tools
test/Microsoft.NET.Sdk.Razor.Test/IntegrationTests
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,9 @@ public static int Main(string[] args)
40
40
outputWriter . Dispose ( ) ;
41
41
errorWriter . Dispose ( ) ;
42
42
43
+ Console . Write ( output ) ;
44
+ Console . Error . Write ( error ) ;
45
+
43
46
// This will no-op if server logging is not enabled.
44
47
ServerLogger . Log ( output ) ;
45
48
ServerLogger . Log ( error ) ;
Original file line number Diff line number Diff line change 6
6
using System . Linq ;
7
7
using System . Runtime . InteropServices ;
8
8
using System . Threading . Tasks ;
9
+ using Microsoft . AspNetCore . Razor . Language ;
9
10
using Microsoft . AspNetCore . Testing . xunit ;
10
11
using Microsoft . Extensions . DependencyModel ;
11
12
using Xunit ;
@@ -652,6 +653,25 @@ public async Task Building_WorksWhenMultipleRazorConfigurationsArePresent()
652
653
Assert . FileExists ( result , OutputPath , "SimpleMvc21.Views.pdb" ) ;
653
654
}
654
655
656
+ [ Fact ]
657
+ [ InitializeTestProject ( "SimpleMvc" ) ]
658
+ public async Task Build_WithoutServer_ErrorDuringBuild_DisplaysErrorInMsBuildOutput ( )
659
+ {
660
+ var result = await DotnetMSBuild (
661
+ "Build" ,
662
+ "/p:UseRazorBuildServer=false /p:RazorLangVersion=5.0" ,
663
+ suppressBuildServer : true ) ;
664
+
665
+ Assert . BuildFailed ( result ) ;
666
+ Assert . BuildOutputContainsLine (
667
+ result ,
668
+ $ "Invalid option 5.0 for Razor language version --version; must be Latest or a valid version in range { RazorLanguageVersion . Version_1_0 } to { RazorLanguageVersion . Latest } .") ;
669
+
670
+ // Compilation failed without creating the views assembly
671
+ Assert . FileExists ( result , IntermediateOutputPath , "SimpleMvc.dll" ) ;
672
+ Assert . FileDoesNotExist ( result , IntermediateOutputPath , "SimpleMvc.Views.dll" ) ;
673
+ }
674
+
655
675
private static DependencyContext ReadDependencyContext ( string depsFilePath )
656
676
{
657
677
var reader = new DependencyContextJsonReader ( ) ;
You can’t perform that action at this time.
0 commit comments