You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MVC uses a ProvideApplicationPartFactoryAttribute on the generated assembly to load compiled views from assembly. Set this to false, to prevent generating this attribute.
<!-- Keep this in sync with RazorLangVersion.cs if we introduce new text based values. -->
50
+
<_Targeting30OrNewerRazorLangVersionCondition="
51
+
'$(RazorLangVersion)' == 'Latest' OR
52
+
'$(RazorLangVersion)' == 'Experimental' OR
53
+
('$(RazorLangVersion)' != '' AND '$(RazorLangVersion)' > '2.9')">true</_Targeting30OrNewerRazorLangVersion>
54
+
</PropertyGroup>
55
+
56
+
57
+
<PropertyGroup>
58
+
<!--
59
+
The property IsRazorCompilerReferenced is defined by the 2.x Razor.Design package. We can use this as a best guess to determine if a project is targeting 2.x or earlier.
60
+
This is useful to provide 3.0 or newer specific build warnings. However, since it's not very reliable, we should not use this to make build-altering decisions.
@@ -228,7 +266,7 @@ Copyright (c) .NET Foundation. All rights reserved.
228
266
<ResolvedRazorCompileToolsetCondition="'$(MvcRazorCompileOnPublish)' == '' AND '$(RazorCompileToolset)' == 'RazorSdk'">$(RazorCompileToolset)</ResolvedRazorCompileToolset>
229
267
230
268
<!-- If RazorSdk is not referenced, fall-back to Precompilation tool when referenced by a 2.2 or earlier targeting project. -->
231
-
<ResolvedRazorCompileToolsetCondition="'$(ResolvedRazorCompileToolset)' == 'RazorSdk' And '$(IsRazorCompilerReferenced)' != 'true' AND '$(_EnableAllInclusiveRazorSdk)' != 'true'">PrecompilationTool</ResolvedRazorCompileToolset>
269
+
<ResolvedRazorCompileToolsetCondition="'$(ResolvedRazorCompileToolset)' == 'RazorSdk' And '$(IsRazorCompilerReferenced)' != 'true'">PrecompilationTool</ResolvedRazorCompileToolset>
232
270
233
271
<!-- Previous versions of the precompilation tool still depends on the msbuild property 'MvcRazorCompileOnPublish'. Hence, setting it to the old default value -->
Text="A PackageReference for 'Microsoft.AspNetCore.Razor.Design' was not included in your project. This package is required to compile Razor files. Typically, a
733
-
transitive reference to 'Microsoft.AspNetCore.Razor.Design' and references required to compile Razor files are obtained by adding a PackageReference
734
-
for 'Microsoft.AspNetCore.Mvc' in your project. For more information, see https://go.microsoft.com/fwlink/?linkid=868374." />
785
+
transitive reference to 'Microsoft.AspNetCore.Razor.Design' and references required to compile Razor files are obtained by adding a PackageReference
786
+
for 'Microsoft.AspNetCore.Mvc' in your project. For more information, see https://go.microsoft.com/fwlink/?linkid=868374." />
787
+
</Target>
788
+
789
+
<TargetName="_CheckForIncorrectMvcConfiguration"
790
+
Condition="'@(ResolvedRazorConfiguration)' == 'Default' AND
791
+
('$(RazorCompileOnBuild)' == 'true' OR '$(RazorCompileOnPublish)' =='true') AND
792
+
'@(RazorGenerate->Count())' != '0' AND
793
+
'$(_Targeting30OrNewerRazorLangVersion)' == 'true' AND
794
+
'$(_IsTargetingRazor2X)' != 'true'">
795
+
<Warning
796
+
Code="RAZORSDK1004"
797
+
Text="One or more Razor view or page files were found, but the project is not configured to add Razor support for MVC. The MSBuild property 'AddRazorSupportForMvc' must be set to correctly
798
+
compile Razor files that target MVC. For more information, see https://go.microsoft.com/fwlink/?linkid=868374." />
Condition="('$(RazorCompileOnBuild)' == 'true' OR '$(RazorCompileOnPublish)' =='true') AND
803
+
'@(RazorComponent->Count())' != '0' AND
804
+
'$(_Targeting30OrNewerRazorLangVersion)' != 'true' AND
805
+
'$(_IsTargetingRazor2X)' != 'true'">
806
+
807
+
<Warning
808
+
Code="RAZORSDK1005"
809
+
Text="One or more Razor component files (.razor) were found, but the project is not configured to compile Razor Components. Configure the project by targeting RazorLangVersion 3.0 or newer.
810
+
For more information, see https://go.microsoft.com/fwlink/?linkid=868374." />
0 commit comments