SDK does not correctly resolve RazorExtension when multiple instances of RazorConfiguration are present
Fixes https://github.com/aspnet/Razor/issues/2721
This commit is contained in:
parent
d3482e7bd0
commit
9d2c394b99
|
|
@ -276,10 +276,10 @@ Copyright (c) .NET Foundation. All rights reserved.
|
||||||
Condition="'$(RazorDefaultConfiguration)'!=''">
|
Condition="'$(RazorDefaultConfiguration)'!=''">
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResolvedRazorConfiguration Include="@(RazorConfiguration)" Condition="'%(RazorConfiguration.Identity)'=='$(RazorDefaultConfiguration)'" />
|
<ResolvedRazorConfiguration Include="@(RazorConfiguration->WithMetadataValue('Identity', '$(RazorDefaultConfiguration)')->Distinct())" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<FindInList List="@(RazorExtension)" ItemSpecToFind="@(RazorConfiguration->Metadata('Extensions'))">
|
<FindInList List="@(RazorExtension)" ItemSpecToFind="@(ResolvedRazorConfiguration->Metadata('Extensions'))">
|
||||||
<Output TaskParameter="ItemFound" ItemName="ResolvedRazorExtension" />
|
<Output TaskParameter="ItemFound" ItemName="ResolvedRazorExtension" />
|
||||||
</FindInList>
|
</FindInList>
|
||||||
</Target>
|
</Target>
|
||||||
|
|
|
||||||
|
|
@ -630,6 +630,28 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
Assert.FileExists(result, OutputPath, "SimpleMvc21.Views.pdb");
|
Assert.FileExists(result, OutputPath, "SimpleMvc21.Views.pdb");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
[InitializeTestProject("SimpleMvc21")]
|
||||||
|
public async Task Building_WorksWhenMultipleRazorConfigurationsArePresent()
|
||||||
|
{
|
||||||
|
TargetFramework = "netcoreapp2.1";
|
||||||
|
AddProjectFileContent(@"
|
||||||
|
<ItemGroup>
|
||||||
|
<RazorConfiguration Include=""MVC-2.1"">
|
||||||
|
<Extensions>MVC-2.1;$(CustomRazorExtension)</Extensions>
|
||||||
|
</RazorConfiguration>
|
||||||
|
</ItemGroup>");
|
||||||
|
|
||||||
|
// Build
|
||||||
|
var result = await DotnetMSBuild("Build");
|
||||||
|
|
||||||
|
Assert.BuildPassed(result);
|
||||||
|
Assert.FileExists(result, OutputPath, "SimpleMvc21.dll");
|
||||||
|
Assert.FileExists(result, OutputPath, "SimpleMvc21.pdb");
|
||||||
|
Assert.FileExists(result, OutputPath, "SimpleMvc21.Views.dll");
|
||||||
|
Assert.FileExists(result, OutputPath, "SimpleMvc21.Views.pdb");
|
||||||
|
}
|
||||||
|
|
||||||
private static DependencyContext ReadDependencyContext(string depsFilePath)
|
private static DependencyContext ReadDependencyContext(string depsFilePath)
|
||||||
{
|
{
|
||||||
var reader = new DependencyContextJsonReader();
|
var reader = new DependencyContextJsonReader();
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@
|
||||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- Test Placeholder -->
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(RunningAsTest)' == ''">
|
<PropertyGroup Condition="'$(RunningAsTest)' == ''">
|
||||||
<!-- We don't want to run build server when not running as tests. -->
|
<!-- We don't want to run build server when not running as tests. -->
|
||||||
<UseRazorBuildServer>false</UseRazorBuildServer>
|
<UseRazorBuildServer>false</UseRazorBuildServer>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
@using SimpleMvc
|
@using SimpleMvc
|
||||||
@using SimpleMvc.Models
|
@using SimpleMvc.Models
|
||||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
|
@namespace SimpleMvc21
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue