Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NUnit3 task on Linux #276

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 21 additions & 23 deletions Source/MSBuild.Community.Tasks/NUnit3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -369,68 +369,66 @@ protected override string GenerateCommandLineCommands()
{
CommandLineBuilder builder = new CommandLineBuilder();

string c = Environment.OSVersion.Platform == PlatformID.Unix ? "-" : "--";

if (EnableShadowCopy)
{
builder.AppendSwitch(c+"shadowcopy");
builder.AppendSwitch("--shadowcopy");
}
if (_testInNewThread.HasValue && !_testInNewThread.Value)
{
builder.AppendSwitch(c+"nothread");
builder.AppendSwitch("--nothread");
}
if(Force32Bit)
{
builder.AppendSwitch(c+"x86");
builder.AppendSwitch("--x86");
}
if (NoHeader)
{
builder.AppendSwitch(c+"noheader");
builder.AppendSwitch("--noheader");
}
if (NoColor)
{
builder.AppendSwitch(c+"nocolor");
builder.AppendSwitch("--nocolor");
}
if (Verbose)
{
builder.AppendSwitch(c+"verbose");
builder.AppendSwitch("--trace=Verbose");
}
builder.AppendFileNamesIfNotNull(_assemblies, " ");

builder.AppendSwitchIfNotNull(c+"config=", _projectConfiguration);
builder.AppendSwitchIfNotNull("--config=", _projectConfiguration);

builder.AppendSwitchIfNotNull(c+"err=", _errorOutputFile);
builder.AppendSwitchIfNotNull("--err=", _errorOutputFile);

builder.AppendSwitchIfNotNull(c+"out=", _textOutputFile);
builder.AppendSwitchIfNotNull("--out=", _textOutputFile);

builder.AppendSwitchIfNotNull(c+"framework=",_framework);
builder.AppendSwitchIfNotNull("--framework=",_framework);

builder.AppendSwitchIfNotNull(c+"process=",_process);
builder.AppendSwitchIfNotNull("--process=",_process);

builder.AppendSwitchIfNotNull(c+"domain=",_domain);
builder.AppendSwitchIfNotNull("--domain=",_domain);

builder.AppendSwitchIfNotNull(c+"apartment=",_apartment);
builder.AppendSwitchIfNotNull("--apartment=",_apartment);

builder.AppendSwitchIfNotNull(c+"where=", _where);
builder.AppendSwitchIfNotNull("--where=", _where);

builder.AppendSwitchIfNotNull(c+"timeout=", _timeout);
builder.AppendSwitchIfNotNull("--timeout=", _timeout);

builder.AppendSwitchIfNotNull(c+"workers=", _workers);
builder.AppendSwitchIfNotNull("--workers=", _workers);

builder.AppendSwitchIfNotNull(c+"result=", _outputXmlFile);
builder.AppendSwitchIfNotNull("--result=", _outputXmlFile);

builder.AppendSwitchIfNotNull(c+"work=", _workingDirectory);
builder.AppendSwitchIfNotNull("--work=", _workingDirectory);

builder.AppendSwitchIfNotNull(c+"labels=", _showLabels);
builder.AppendSwitchIfNotNull("--labels=", _showLabels);

builder.AppendSwitchIfNotNull(c+"trace=", _trace);
builder.AppendSwitchIfNotNull("--trace=", _trace);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Propose to change to:

if(!Verbose) builder.AppendSwitchIfNotNull("--trace=", _trace);


return builder.ToString();
}

private void CheckToolPath()
{
string nunitPath = ToolPath == null ? String.Empty : ToolPath.Trim();
string nunitPath = ToolPath?.Trim() ?? String.Empty;
if (!String.IsNullOrEmpty(nunitPath))
{
ToolPath = nunitPath;
Expand Down