Use MVC 2.1 at design time for Razor 3.0 projects. (dotnet/aspnetcore-tooling#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.

(cherry picked from commit dotnet/aspnetcore-tooling@0326abe530)
\n\nCommit migrated from a6dc88e455
This commit is contained in:
N. Taylor Mullen 2018-11-29 12:41:29 -08:00 committed by Ryan Nowak
parent 5bb16b1a14
commit c8bb6c34bb
1 changed files with 31 additions and 2 deletions

View File

@ -50,6 +50,12 @@ Copyright (c) .NET Foundation. All rights reserved.
<PropertyGroup Condition="'$(RazorLangVersion)'==''">
<RazorLangVersion Condition="'$(_TargetingNETCoreApp30OrLater)' == 'true'">3.0</RazorLangVersion>
<!--
For dev16 the Razor toolings bits don't currently understand 3.0 projects. Therefore, we default to 2.1 which is currently
functionally equivalent. This will be undone in the near future.
-->
<RazorLangVersion Condition="'$(_TargetingNETCoreApp30OrLater)' == 'true' AND '$(DesignTimeBuild)' == 'true'">2.1</RazorLangVersion>
</PropertyGroup>
<!--
@ -57,6 +63,12 @@ Copyright (c) .NET Foundation. All rights reserved.
-->
<PropertyGroup Condition="'$(RazorDefaultConfiguration)'==''">
<RazorDefaultConfiguration Condition="'$(_TargetingNETCoreApp30OrLater)' == 'true'">MVC-3.0</RazorDefaultConfiguration>
<!--
For dev16 the Razor toolings bits don't currently understand 3.0 projects. Therefore, we default to 2.1 which is currently
functionally equivalent. This will be undone in the near future.
-->
<RazorDefaultConfiguration Condition="'$(_TargetingNETCoreApp30OrLater)' == 'true' AND '$(DesignTimeBuild)' == 'true'">MVC-2.1</RazorDefaultConfiguration>
</PropertyGroup>
<ItemGroup>
@ -65,16 +77,33 @@ Copyright (c) .NET Foundation. All rights reserved.
it here. The IDE is hardcoded to inject 2.0 support when needed. The settings flowing through MSBuild should reflect
the project's runtime.
-->
<RazorConfiguration Include="MVC-3.0">
<RazorConfiguration Include="MVC-3.0" Condition="'$(DesignTimeBuild)' != 'true'">
<Extensions>MVC-3.0;$(CustomRazorExtension)</Extensions>
</RazorConfiguration>
<!--
For dev16 the Razor toolings bits don't currently understand 3.0 projects. Therefore, we default to 2.1 which is currently
functionally equivalent. This will be undone in the near future.
-->
<RazorConfiguration Include="MVC-2.1" Condition="'$(DesignTimeBuild)' == 'true'">
<Extensions>MVC-2.1;$(CustomRazorExtension)</Extensions>
</RazorConfiguration>
</ItemGroup>
<ItemGroup>
<RazorExtension Include="MVC-3.0">
<RazorExtension Include="MVC-3.0" Condition="'$(DesignTimeBuild)' != 'true'">
<AssemblyName>Microsoft.AspNetCore.Mvc.Razor.Extensions</AssemblyName>
<AssemblyFilePath>$(RazorSdkDirectoryRoot)extensions\mvc-3-0\Microsoft.AspNetCore.Mvc.Razor.Extensions.dll</AssemblyFilePath>
</RazorExtension>
<!--
For dev16 the Razor toolings bits don't currently understand 3.0 projects. Therefore, we default to 2.1 which is currently
functionally equivalent. This will be undone in the near future.
-->
<RazorExtension Include="MVC-2.1" Condition="'$(DesignTimeBuild)' == 'true'">
<AssemblyName>Microsoft.AspNetCore.Mvc.Razor.Extensions</AssemblyName>
<AssemblyFilePath>$(RazorSdkDirectoryRoot)extensions\mvc-2-1\Microsoft.AspNetCore.Mvc.Razor.Extensions.dll</AssemblyFilePath>
</RazorExtension>
</ItemGroup>
<ItemGroup Condition="'$(GenerateRazorAssemblyInfo)'=='true' AND '$(ResolvedRazorCompileToolset)'=='RazorSdk' AND ('$(RazorCompileOnBuild)' == 'true' OR '$(RazorCompileOnPublish)' == 'true')">