-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathCheckForTargetInAssetsFile.cs
More file actions
41 lines (32 loc) · 1.21 KB
/
CheckForTargetInAssetsFile.cs
File metadata and controls
41 lines (32 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#nullable disable
using Microsoft.Build.Framework;
using NuGet.ProjectModel;
namespace Microsoft.NET.Build.Tasks
{
[MSBuildMultiThreadableTask]
public class CheckForTargetInAssetsFile : TaskBase, IMultiThreadableTask
{
#if NETFRAMEWORK
private TaskEnvironment _taskEnvironment;
public TaskEnvironment TaskEnvironment
{
get => _taskEnvironment ??= TaskEnvironmentDefaults.Create();
set => _taskEnvironment = value;
}
#else
public TaskEnvironment TaskEnvironment { get; set; }
#endif
public string AssetsFilePath { get; set; }
[Required]
public string TargetFramework { get; set; }
public string RuntimeIdentifier { get; set; }
protected override void ExecuteCore()
{
AbsolutePath assetsFilePath = TaskEnvironment.GetAbsolutePath(AssetsFilePath);
LockFile lockFile = new LockFileCache(this).GetLockFile(assetsFilePath);
lockFile.GetTargetAndThrowIfNotFound(TargetFramework, RuntimeIdentifier);
}
}
}