Skip to content

Commit

Permalink
reimplement JanKrivanek's changes from #45880
Browse files Browse the repository at this point in the history
  • Loading branch information
Forgind committed Jan 17, 2025
1 parent f390846 commit e95e9b3
Showing 1 changed file with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,32 @@ public void SupportRespectAlreadyAssignedItemCulture_ByDefault_ForDotnet9(string
new FileInfo(Path.Combine(outputDirectory, "test-2", "MSBuildCultureResourceGeneration.resources.dll")).Should().Exist();
}

[Theory]
[CoreMSBuildOnlyTheory]
[InlineData("net7.0")]
[InlineData("net6.0")]
public void SupportRespectAlreadyAssignedItemCulture_IsNotSupported_BuildShouldWarn(string targetFramework)
{
var testAsset = _testAssetsManager
.CopyTestAsset("MSBuildCultureResourceGeneration", identifier: targetFramework)
.WithSource()
.WithTargetFramework(targetFramework);

var buildCommand = new BuildCommand(testAsset);
// Custom culture is allowed, but if set explicitly and overwritten - a warning is issued.
buildCommand.Execute().Should().Pass().And
// warning MSB3002: Explicitly set culture "test-1" for item "Resources.test-1.resx" was overwritten with inferred culture "", because 'RespectAlreadyAssignedItemCulture' property was not set.
.HaveStdOutContaining("warning MSB3002:");
}

[FullMSBuildOnlyTheory]
[InlineData("net7.0")]
[InlineData("net6.0")]
// Is this Failing? Is full FW MSBuild already on 17.13? Then remove this test and remove `[CoreMSBuildOnlyTheory]` attribute on the test above
//
// Until MSBuild 17.13 is merged into FullFW MSBuild in sdk tests - the test will fail, as
// proper recognition of custom cultures in RAR is not supported and hence the build will fail during copy:
//
// Microsoft.Common.CurrentVersion.targets(4959,5): error MSB3030: Could not copy the file "obj\Debug\net7.0\test-1\MSBuildCultureResourceGeneration.resources.dll" because it was not found.
public void SupportRespectAlreadyAssignedItemCulture_IsNotSupported_BuildShouldFail(string targetFramework)
{
var testAsset = _testAssetsManager
Expand Down

0 comments on commit e95e9b3

Please sign in to comment.