Skip to content

Commit 86c6645

Browse files
committed
enable testing with Full Framework
This enabled testing the GitVersion.MsBuild with the full .NET Framework's version of msbuild
1 parent 5671084 commit 86c6645

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

build/artifacts/Tasks/ArtifactsMsBuildFullTest.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ public override void Run(BuildContext context)
1919
if (context.Version == null)
2020
return;
2121
var version = context.Version.NugetVersion;
22+
var fullSemVer = context.Version.GitVersion.FullSemVer;
2223

2324
var nugetSource = context.MakeAbsolute(Paths.Nuget).FullPath;
2425

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+
2529
context.Information("\nTesting msbuild task with dotnet build\n");
2630
foreach (var netVersion in Constants.DotnetVersions)
2731
{
@@ -40,7 +44,27 @@ public override void Run(BuildContext context)
4044
});
4145

4246
var exe = Paths.Integration.Combine("build").Combine(framework).CombineWithFilePath("app.dll");
43-
context.ValidateOutput("dotnet", exe.FullPath, context.Version.GitVersion.FullSemVer);
47+
context.ValidateOutput("dotnet", exe.FullPath, fullSemVer);
48+
49+
if (!isMsBuildToolVersionValid) continue;
50+
51+
const MSBuildToolVersion toolVersion = (MSBuildToolVersion)toolVersionValue;
52+
context.Information("\nTesting msbuild task with msbuild (for full framework)\n");
53+
54+
var msBuildSettings = new MSBuildSettings
55+
{
56+
Verbosity = Verbosity.Minimal,
57+
ToolVersion = toolVersion,
58+
Restore = true
59+
};
60+
61+
msBuildSettings.WithProperty("GitVersionMsBuildVersion", version);
62+
msBuildSettings.WithProperty("RestoreSource", nugetSource);
63+
64+
context.MSBuild(projPath.FullPath, msBuildSettings);
65+
66+
var fullExe = Paths.Integration.Combine("build").CombineWithFilePath("app.exe");
67+
context.ValidateOutput(fullExe.FullPath, null, fullSemVer);
4468
}
4569
}
4670
}

0 commit comments

Comments
 (0)