Merge pull request #6 from nunit/enable_building_with_vs2019
Enable building with VS2019
This commit is contained in:
Коммит
f0cacd0204
|
@ -1,4 +1,6 @@
|
|||
build_script:
|
||||
image: Visual Studio 2019
|
||||
|
||||
build_script:
|
||||
- ps: .\build.ps1 -Target "Appveyor"
|
||||
|
||||
# disable built-in tests.
|
||||
|
|
50
build.cake
50
build.cake
|
@ -42,6 +42,7 @@ Task("DiscoverSolutions")
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
// CLEAN
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
Task("Clean")
|
||||
.IsDependentOn("DiscoverSolutions")
|
||||
|
@ -78,9 +79,9 @@ Task("Build")
|
|||
|
||||
try
|
||||
{
|
||||
BuildProject(proj, configuration);
|
||||
MSBuild(proj, CreateSettings());
|
||||
}
|
||||
catch (Exception e)
|
||||
catch
|
||||
{
|
||||
// Just record and continue, since samples are independent
|
||||
ErrorDetail.Add(" * " + projName + " build failed.");
|
||||
|
@ -88,6 +89,30 @@ Task("Build")
|
|||
}
|
||||
});
|
||||
|
||||
// Workaround until Cake 0.34 (https://github.com/cake-build/cake/issues/2546#issuecomment-490756492)
|
||||
MSBuildSettings CreateSettings()
|
||||
{
|
||||
var settings = new MSBuildSettings { Verbosity = Verbosity.Minimal, Configuration = configuration };
|
||||
|
||||
if (IsRunningOnWindows())
|
||||
{
|
||||
var vsLatest = VSWhereLatest();
|
||||
var msBuildPath = vsLatest?.CombineWithFilePath("./MSBuild/Current/Bin/MSBuild.exe");
|
||||
|
||||
if (msBuildPath != null && !FileExists(msBuildPath))
|
||||
msBuildPath = vsLatest?.CombineWithFilePath("./MSBuild/15.0/Bin/MSBuild.exe");
|
||||
|
||||
if (!FileExists(msBuildPath))
|
||||
throw new Exception($"Failed to find MSBuild: {msBuildPath}");
|
||||
|
||||
settings.ToolPath = msBuildPath;
|
||||
}
|
||||
else
|
||||
settings.ToolPath = Context.Tools.Resolve("msbuild");
|
||||
|
||||
return settings;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// TEST
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -121,7 +146,7 @@ Task("Test")
|
|||
// TEARDOWN TASK
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
Teardown(() =>
|
||||
Teardown(context =>
|
||||
{
|
||||
CheckForError(ref ErrorDetail);
|
||||
});
|
||||
|
@ -142,25 +167,6 @@ void CheckForError(ref List<string> errorDetail)
|
|||
// HELPER METHODS
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
void BuildProject(string projPath, string configuration)
|
||||
{
|
||||
if (IsRunningOnWindows())
|
||||
{
|
||||
MSBuild(projPath, new MSBuildSettings()
|
||||
.SetConfiguration(configuration)
|
||||
.SetMSBuildPlatform(MSBuildPlatform.Automatic)
|
||||
.SetVerbosity(Verbosity.Minimal)
|
||||
.SetNodeReuse(false));
|
||||
}
|
||||
else
|
||||
{
|
||||
XBuild(projPath, new XBuildSettings()
|
||||
.WithTarget("Build")
|
||||
.WithProperty("Configuration", configuration)
|
||||
.SetVerbosity(Verbosity.Minimal));
|
||||
}
|
||||
}
|
||||
|
||||
string DirFrom(string filePath)
|
||||
{
|
||||
return System.IO.Path.GetDirectoryName(filePath);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Cake" version="0.20.0" />
|
||||
<package id="NUnit.ConsoleRunner" version="3.6.1" />
|
||||
<package id="Cake" version="0.33.0" />
|
||||
<package id="NUnit.ConsoleRunner" version="3.10.0" />
|
||||
</packages>
|
Загрузка…
Ссылка в новой задаче