@@ -34,6 +34,7 @@ private async Task Build_ProjectWithDependencyThatReferencesMvc_AddsAttribute(MS
34
34
35
35
Assert . FileExists ( result , IntermediateOutputPath , "AppWithP2PReference.MvcApplicationPartsAssemblyInfo.cs" ) ;
36
36
Assert . FileContains ( result , Path . Combine ( IntermediateOutputPath , "AppWithP2PReference.MvcApplicationPartsAssemblyInfo.cs" ) , "[assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute(\" ClassLibrary\" )]" ) ;
37
+ Assert . AssemblyHasAttribute ( result , Path . Combine ( OutputPath , "AppWithP2PReference.dll" ) , "Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute" ) ;
37
38
}
38
39
39
40
[ Fact ]
@@ -69,6 +70,33 @@ public async Task BuildIncrementalism_WhenApplicationPartAttributeIsGenerated()
69
70
70
71
Assert . FileExists ( result , generatedAttributeFile ) ;
71
72
Assert . Equal ( thumbPrint , GetThumbPrint ( generatedAttributeFile ) ) ;
73
+ Assert . AssemblyHasAttribute ( result , Path . Combine ( OutputPath , "AppWithP2PReference.dll" ) , "Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute" ) ;
74
+ }
75
+
76
+ // Regression test for https://github.com/aspnet/AspNetCore/issues/11315
77
+ [ Fact ]
78
+ [ InitializeTestProject ( "AppWithP2PReference" , additionalProjects : "ClassLibrary" ) ]
79
+ public async Task BuildIncrementalism_CausingRecompilation_WhenApplicationPartAttributeIsGenerated ( )
80
+ {
81
+ var result = await DotnetMSBuild ( "Build" ) ;
82
+
83
+ Assert . BuildPassed ( result ) ;
84
+
85
+ var generatedAttributeFile = Path . Combine ( IntermediateOutputPath , "AppWithP2PReference.MvcApplicationPartsAssemblyInfo.cs" ) ;
86
+ Assert . FileExists ( result , generatedAttributeFile ) ;
87
+ Assert . FileContains ( result , generatedAttributeFile , "[assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute(\" ClassLibrary\" )]" ) ;
88
+
89
+ var thumbPrint = GetThumbPrint ( generatedAttributeFile ) ;
90
+
91
+ // Touch a file in the main app which should call recompilation, but not the Mvc discovery tasks to re-run.
92
+ File . AppendAllText ( Path . Combine ( Project . DirectoryPath , "Program.cs" ) , " " ) ;
93
+ result = await DotnetMSBuild ( "Build" ) ;
94
+
95
+ Assert . BuildPassed ( result ) ;
96
+
97
+ Assert . FileExists ( result , generatedAttributeFile ) ;
98
+ Assert . Equal ( thumbPrint , GetThumbPrint ( generatedAttributeFile ) ) ;
99
+ Assert . AssemblyHasAttribute ( result , Path . Combine ( OutputPath , "AppWithP2PReference.dll" ) , "Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute" ) ;
72
100
}
73
101
74
102
[ Fact ]
@@ -88,6 +116,7 @@ public async Task Build_ProjectWithDependencyThatReferencesMvc_AddsAttributeToNo
88
116
89
117
Assert . FileExists ( result , IntermediateOutputPath , "SimpleMvcFSharp.MvcApplicationPartsAssemblyInfo.fs" ) ;
90
118
Assert . FileContains ( result , Path . Combine ( IntermediateOutputPath , "SimpleMvcFSharp.MvcApplicationPartsAssemblyInfo.fs" ) , "<assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute(\" ClassLibrary\" )>" ) ;
119
+ Assert . AssemblyHasAttribute ( result , Path . Combine ( OutputPath , "SimpleMvcFSharp.dll" ) , "Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute" ) ;
91
120
}
92
121
93
122
[ Fact ]
0 commit comments