Skip to content

Commit 27bf3f5

Browse files
committed
Fix
1 parent edb7ac2 commit 27bf3f5

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

src/Platform/Microsoft.Testing.Platform.MSBuild/Tasks/InvokeTestingPlatformTask.cs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,26 +69,22 @@ public InvokeTestingPlatformTask()
6969
/// <summary>
7070
/// Gets or sets the value of MSBuild property UseAppHost.
7171
/// </summary>
72-
[Required]
73-
public ITaskItem UseAppHost { get; set; }
72+
public ITaskItem? UseAppHost { get; set; }
7473

7574
/// <summary>
7675
/// Gets or sets the value of MSBuild property _IsExecutable.
7776
/// </summary>
78-
[Required]
79-
public ITaskItem IsExecutable { get; set; }
77+
public ITaskItem? IsExecutable { get; set; }
8078

8179
/// <summary>
8280
/// Gets or sets the value of MSBuild property TargetDir.
8381
/// </summary>
84-
[Required]
85-
public ITaskItem TargetDir { get; set; }
82+
public ITaskItem? TargetDir { get; set; }
8683

8784
/// <summary>
8885
/// Gets or sets the value of MSBuild property AssemblyName.
8986
/// </summary>
90-
[Required]
91-
public ITaskItem AssemblyName { get; set; }
87+
public ITaskItem? AssemblyName { get; set; }
9288

9389
/// <summary>
9490
/// Gets or sets the value of MSBuild property _NativeExecutableExtension.
@@ -259,10 +255,10 @@ private bool IsCurrentProcessArchitectureCompatible() =>
259255
// https://github.com/dotnet/sdk/blob/5846d648f2280b54a54e481f55de4d9eea0e6a0e/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets#L1152-L1155
260256
// The more correct logic is implementing https://github.com/microsoft/testfx/issues/5091
261257
if (IsNetCoreApp &&
262-
bool.TryParse(IsExecutable.ItemSpec, out bool isExecutable) && isExecutable &&
263-
bool.TryParse(UseAppHost.ItemSpec, out bool useAppHost) && useAppHost)
258+
bool.TryParse(IsExecutable?.ItemSpec, out bool isExecutable) && isExecutable &&
259+
bool.TryParse(UseAppHost?.ItemSpec, out bool useAppHost) && useAppHost)
264260
{
265-
string runCommand = $"{TargetDir.ItemSpec}{AssemblyName.ItemSpec}{NativeExecutableExtension?.ItemSpec}";
261+
string runCommand = $"{TargetDir?.ItemSpec}{AssemblyName?.ItemSpec}{NativeExecutableExtension?.ItemSpec}";
266262
if (File.Exists(runCommand))
267263
{
268264
return runCommand;

0 commit comments

Comments
 (0)