Skip to content

Commit 3bc72df

Browse files
committed
Fix the build script to run on Ubuntu
1 parent c4417ad commit 3bc72df

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

build.cake

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#tool dotnet:?package=GitVersion.Tool&version=5.6.6
33
#tool nuget:?package=GitReleaseManager&version=0.11.0
44
#tool nuget:?package=OpenCover&version=4.7.1221
5-
#tool nuget:?package=ReportGenerator&version=4.8.11
5+
#tool nuget:?package=ReportGenerator&version=4.8.12
66
#tool nuget:?package=coveralls.io&version=1.4.2
77
#tool nuget:?package=xunit.runner.console&version=2.4.1
88

@@ -201,7 +201,8 @@ Task("Build")
201201
{
202202
Configuration = configuration,
203203
NoRestore = true,
204-
ArgumentCustomization = args => args.Append("/p:SemVer=" + versionInfo.LegacySemVerPadded)
204+
ArgumentCustomization = args => args.Append("/p:SemVer=" + versionInfo.LegacySemVerPadded),
205+
Framework = IsRunningOnWindows() ? null : "net5.0"
205206
});
206207
});
207208

@@ -213,19 +214,26 @@ Task("Run-Unit-Tests")
213214
{
214215
NoBuild = true,
215216
NoRestore = true,
216-
Configuration = configuration
217+
Configuration = configuration,
218+
Framework = IsRunningOnWindows() ? null : "net5.0"
217219
});
218220
});
219221

220222
Task("Run-Code-Coverage")
221223
.IsDependentOn("Build")
222224
.Does(() =>
223225
{
226+
// For the purpose of calculating code coverage, a single target will suffice.
227+
// FYI, this will cause an error if the unit test project is not configured
228+
// to target this desired framework:
229+
var desiredFramework = "net5.0";
230+
224231
Action<ICakeContext> testAction = ctx => ctx.DotNetCoreTest(unitTestsProject, new DotNetCoreTestSettings
225232
{
226233
NoBuild = true,
227234
NoRestore = true,
228-
Configuration = configuration
235+
Configuration = configuration,
236+
Framework = desiredFramework
229237
});
230238

231239
OpenCover(testAction,

0 commit comments

Comments
 (0)