Skip to content

Commit 38594ce

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 e03d625 commit 38594ce

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,6 +19,7 @@ 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

@@ -40,7 +41,30 @@ public override void Run(BuildContext context)
4041
});
4142

4243
var exe = Paths.Integration.Combine("build").Combine(framework).CombineWithFilePath("app.dll");
43-
context.ValidateOutput("dotnet", exe.FullPath, context.Version.GitVersion.FullSemVer);
44+
context.ValidateOutput("dotnet", exe.FullPath, fullSemVer);
45+
46+
const int toolVersionValue = 11; // Workaround for now. It should be removed when https://github.com/cake-build/cake/issues/4658 is merged
47+
var isDefined = Enum.IsDefined(typeof(MSBuildToolVersion), toolVersionValue);
48+
49+
if (!isDefined) 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)