Skip to content

Commit 0326abe

Browse files
N. Taylor Mullennatemcmaster
authored andcommitted
Use MVC 2.1 at design time for Razor 3.0 projects. (#4324)
- When we detect a design time build we force tooling to use 2.1 - In runtime builds (i.e. rzc) it still uses the 3.0 configuration for 3.0 apps.
1 parent 1b46549 commit 0326abe

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

src/Razor/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.Configuration.targets

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,25 @@ Copyright (c) .NET Foundation. All rights reserved.
5050

5151
<PropertyGroup Condition="'$(RazorLangVersion)'==''">
5252
<RazorLangVersion Condition="'$(_TargetingNETCoreApp30OrLater)' == 'true'">3.0</RazorLangVersion>
53+
54+
<!--
55+
For dev16 the Razor toolings bits don't currently understand 3.0 projects. Therefore, we default to 2.1 which is currently
56+
functionally equivalent. This will be undone in the near future.
57+
-->
58+
<RazorLangVersion Condition="'$(_TargetingNETCoreApp30OrLater)' == 'true' AND '$(DesignTimeBuild)' == 'true'">2.1</RazorLangVersion>
5359
</PropertyGroup>
5460

5561
<!--
5662
Set the primary configuration supported by this SDK as the default configuration for Razor.
5763
-->
5864
<PropertyGroup Condition="'$(RazorDefaultConfiguration)'==''">
5965
<RazorDefaultConfiguration Condition="'$(_TargetingNETCoreApp30OrLater)' == 'true'">MVC-3.0</RazorDefaultConfiguration>
66+
67+
<!--
68+
For dev16 the Razor toolings bits don't currently understand 3.0 projects. Therefore, we default to 2.1 which is currently
69+
functionally equivalent. This will be undone in the near future.
70+
-->
71+
<RazorDefaultConfiguration Condition="'$(_TargetingNETCoreApp30OrLater)' == 'true' AND '$(DesignTimeBuild)' == 'true'">MVC-2.1</RazorDefaultConfiguration>
6072
</PropertyGroup>
6173

6274
<ItemGroup>
@@ -65,16 +77,33 @@ Copyright (c) .NET Foundation. All rights reserved.
6577
it here. The IDE is hardcoded to inject 2.0 support when needed. The settings flowing through MSBuild should reflect
6678
the project's runtime.
6779
-->
68-
<RazorConfiguration Include="MVC-3.0">
80+
<RazorConfiguration Include="MVC-3.0" Condition="'$(DesignTimeBuild)' != 'true'">
6981
<Extensions>MVC-3.0;$(CustomRazorExtension)</Extensions>
7082
</RazorConfiguration>
83+
84+
<!--
85+
For dev16 the Razor toolings bits don't currently understand 3.0 projects. Therefore, we default to 2.1 which is currently
86+
functionally equivalent. This will be undone in the near future.
87+
-->
88+
<RazorConfiguration Include="MVC-2.1" Condition="'$(DesignTimeBuild)' == 'true'">
89+
<Extensions>MVC-2.1;$(CustomRazorExtension)</Extensions>
90+
</RazorConfiguration>
7191
</ItemGroup>
7292

7393
<ItemGroup>
74-
<RazorExtension Include="MVC-3.0">
94+
<RazorExtension Include="MVC-3.0" Condition="'$(DesignTimeBuild)' != 'true'">
7595
<AssemblyName>Microsoft.AspNetCore.Mvc.Razor.Extensions</AssemblyName>
7696
<AssemblyFilePath>$(RazorSdkDirectoryRoot)extensions\mvc-3-0\Microsoft.AspNetCore.Mvc.Razor.Extensions.dll</AssemblyFilePath>
7797
</RazorExtension>
98+
99+
<!--
100+
For dev16 the Razor toolings bits don't currently understand 3.0 projects. Therefore, we default to 2.1 which is currently
101+
functionally equivalent. This will be undone in the near future.
102+
-->
103+
<RazorExtension Include="MVC-2.1" Condition="'$(DesignTimeBuild)' == 'true'">
104+
<AssemblyName>Microsoft.AspNetCore.Mvc.Razor.Extensions</AssemblyName>
105+
<AssemblyFilePath>$(RazorSdkDirectoryRoot)extensions\mvc-2-1\Microsoft.AspNetCore.Mvc.Razor.Extensions.dll</AssemblyFilePath>
106+
</RazorExtension>
78107
</ItemGroup>
79108

80109
<ItemGroup Condition="'$(GenerateRazorAssemblyInfo)'=='true' AND '$(ResolvedRazorCompileToolset)'=='RazorSdk' AND ('$(RazorCompileOnBuild)' == 'true' OR '$(RazorCompileOnPublish)' == 'true')">

0 commit comments

Comments
 (0)