Skip to content

Commit 9c1bd70

Browse files
committed
build(msbuild): Remove MSBuildToolVersion workaround
The MSBuildToolVersion.VS2026 enum value is now directly available, making the previous integer-based workaround unnecessary.
1 parent 10e51e7 commit 9c1bd70

1 file changed

Lines changed: 18 additions & 15 deletions

File tree

build/artifacts/Tasks/ArtifactsMsBuildFullTest.cs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ public override void Run(BuildContext context)
2323

2424
var nugetSource = context.MakeAbsolute(Paths.Nuget).FullPath;
2525

26-
const int toolVersionValue = 11; // Workaround for now. It should be removed when https://github.com/cake-build/cake/issues/4658 is merged
27-
var isMsBuildToolVersionValid = Enum.IsDefined(typeof(MSBuildToolVersion), toolVersionValue);
28-
2926
context.Information("\nTesting msbuild task with dotnet build\n");
3027
foreach (var netVersion in Constants.DotnetVersions)
3128
{
@@ -46,25 +43,31 @@ public override void Run(BuildContext context)
4643
var exe = Paths.Integration.Combine("build").Combine(framework).CombineWithFilePath("app.dll");
4744
context.ValidateOutput("dotnet", exe.FullPath, fullSemVer);
4845

49-
if (!isMsBuildToolVersionValid) continue;
46+
if (!Enum.IsDefined(MSBuildToolVersion.VS2026)) continue;
5047

51-
const MSBuildToolVersion toolVersion = (MSBuildToolVersion)toolVersionValue;
5248
context.Information("\nTesting msbuild task with msbuild (for full framework)\n");
5349

54-
var msBuildSettings = new MSBuildSettings
50+
try
5551
{
56-
Verbosity = Verbosity.Minimal,
57-
ToolVersion = toolVersion,
58-
Restore = true
59-
};
52+
var msBuildSettings = new MSBuildSettings
53+
{
54+
Verbosity = Verbosity.Minimal,
55+
ToolVersion = MSBuildToolVersion.VS2026,
56+
Restore = true
57+
};
6058

61-
msBuildSettings.WithProperty("GitVersionMsBuildVersion", version);
62-
msBuildSettings.WithProperty("RestoreSource", nugetSource);
59+
msBuildSettings.WithProperty("GitVersionMsBuildVersion", version);
60+
msBuildSettings.WithProperty("RestoreSource", nugetSource);
6361

64-
context.MSBuild(projPath.FullPath, msBuildSettings);
62+
context.MSBuild(projPath.FullPath, msBuildSettings);
6563

66-
var fullExe = Paths.Integration.Combine("build").CombineWithFilePath("app.exe");
67-
context.ValidateOutput(fullExe.FullPath, null, fullSemVer);
64+
var fullExe = Paths.Integration.Combine("build").CombineWithFilePath("app.exe");
65+
context.ValidateOutput(fullExe.FullPath, null, fullSemVer);
66+
}
67+
catch (Exception e)
68+
{
69+
context.Error(e.Message);
70+
}
6871
}
6972
}
7073
}

0 commit comments

Comments
 (0)