Fixup invalid configuration error message (dotnet/aspnetcore-tooling#365)
* Fix invalid parameter used in error message
* Re-organize test code\n\nCommit migrated from 5a73c2abe9
This commit is contained in:
parent
9c35c07a0b
commit
6eb9044660
|
|
@ -372,13 +372,12 @@ Copyright (c) .NET Foundation. All rights reserved.
|
||||||
ResolvedRazorConfiguration should only ever have one item in it. If misconfigured, we may resolve more than one item which
|
ResolvedRazorConfiguration should only ever have one item in it. If misconfigured, we may resolve more than one item which
|
||||||
may result in incorrect results or poorly worded build errors.
|
may result in incorrect results or poorly worded build errors.
|
||||||
-->
|
-->
|
||||||
<Warning Text="Unable to resolve a Razor configuration for the value '$(_RazorConfiguration)'. Available configurations '@(RazorConfiguration)'.'"
|
<Warning Text="Unable to resolve a Razor configuration for the value '$(RazorDefaultConfiguration)'. Available configurations '@(RazorConfiguration->'%(Identity)', ', ')'.'"
|
||||||
Code="RazorSDK1000"
|
Code="RAZORSDK1000"
|
||||||
Condition="'@(ResolvedRazorConfiguration->Count())' == '0'" />
|
Condition="'@(ResolvedRazorConfiguration->Count())' == '0'" />
|
||||||
|
|
||||||
<Warning Text="More than one Razor configuration was resolved for the value '$(_RazorConfiguration)'. Available configurations '@(RazorConfiguration)'.
|
<Warning Text="More than one Razor configuration was resolved for the value '$(RazorDefaultConfiguration)'. Available configurations '@(RazorConfiguration->'%(Identity)', ', ')'."
|
||||||
A common cause is a reference to an incompatible version of the 'Microsoft.AspNetCore.Mvc' or 'Microsoft.AspNetCore.Razor.Design' package."
|
Code="RAZORSDK1001"
|
||||||
Code="RazorSDK1001"
|
|
||||||
Condition="'@(ResolvedRazorConfiguration->Count())' > '1'" />
|
Condition="'@(ResolvedRazorConfiguration->Count())' > '1'" />
|
||||||
|
|
||||||
<FindInList
|
<FindInList
|
||||||
|
|
|
||||||
|
|
@ -606,28 +606,6 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
Assert.Equal(firstAssemblyBytes, secondAssemblyBytes);
|
Assert.Equal(firstAssemblyBytes, secondAssemblyBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
[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");
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
[InitializeTestProject("SimpleMvc")]
|
[InitializeTestProject("SimpleMvc")]
|
||||||
public async Task Build_WithoutServer_ErrorDuringBuild_DisplaysErrorInMsBuildOutput()
|
public async Task Build_WithoutServer_ErrorDuringBuild_DisplaysErrorInMsBuildOutput()
|
||||||
|
|
@ -690,6 +668,20 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
Assert.BuildWarning(result, "RAZORSDK1004");
|
Assert.BuildWarning(result, "RAZORSDK1004");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
[InitializeTestProject("ClassLibrary")]
|
||||||
|
public async Task Build_WithNoResolvedRazorConfiguration()
|
||||||
|
{
|
||||||
|
AddProjectFileContent(@"
|
||||||
|
<PropertyGroup>
|
||||||
|
<RazorDefaultConfiguration>Custom12.3</RazorDefaultConfiguration>
|
||||||
|
</PropertyGroup>");
|
||||||
|
|
||||||
|
var result = await DotnetMSBuild("Build");
|
||||||
|
|
||||||
|
Assert.BuildWarning(result, "RAZORSDK1000");
|
||||||
|
}
|
||||||
|
|
||||||
private static DependencyContext ReadDependencyContext(string depsFilePath)
|
private static DependencyContext ReadDependencyContext(string depsFilePath)
|
||||||
{
|
{
|
||||||
var reader = new DependencyContextJsonReader();
|
var reader = new DependencyContextJsonReader();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
{
|
{
|
||||||
public class BuildIntegrationTest21 : BuildIntegrationTestLegacy
|
public class BuildIntegrationTest21 : BuildIntegrationTestLegacy
|
||||||
|
|
@ -12,5 +15,28 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
|
|
||||||
public override string TestProjectName => "SimpleMvc21";
|
public override string TestProjectName => "SimpleMvc21";
|
||||||
public override string TargetFramework => "netcoreapp2.1";
|
public override string TargetFramework => "netcoreapp2.1";
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task Building_WorksWhenMultipleRazorConfigurationsArePresent()
|
||||||
|
{
|
||||||
|
using (var project = CreateTestProject())
|
||||||
|
{
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue