File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
src/Cli/dotnet/commands/dotnet-workload/restore Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -44,23 +44,29 @@ public override int Execute()
44
44
return 0 ;
45
45
}
46
46
47
+ private static string GetRequiredWorkloadsTargetName = "_GetRequiredWorkloads" ;
48
+
47
49
private List < WorkloadId > RunTargetToGetWorkloadIds ( IEnumerable < string > allProjects )
48
50
{
49
51
var globalProperties = new Dictionary < string , string > ( StringComparer . OrdinalIgnoreCase )
50
52
{
51
53
{ "SkipResolvePackageAssets" , "true" }
52
54
} ;
53
55
56
+
54
57
var allWorkloadId = new List < WorkloadId > ( ) ;
55
58
foreach ( string projectFile in allProjects )
56
59
{
57
60
var project = new ProjectInstance ( projectFile , globalProperties , null ) ;
61
+ if ( ! project . Targets . ContainsKey ( GetRequiredWorkloadsTargetName ) )
62
+ {
63
+ continue ;
64
+ }
58
65
59
- bool buildResult = project . Build ( new [ ] { "_GetRequiredWorkloads" } ,
60
- loggers : new ILogger [ ]
61
- {
66
+ bool buildResult = project . Build ( [ GetRequiredWorkloadsTargetName ] ,
67
+ loggers : [
62
68
new ConsoleLogger ( Verbosity . ToLoggerVerbosity ( ) )
63
- } ,
69
+ ] ,
64
70
remoteLoggers : Enumerable . Empty < ForwardingLoggerRecord > ( ) ,
65
71
targetOutputs : out var targetOutputs ) ;
66
72
@@ -73,7 +79,7 @@ private List<WorkloadId> RunTargetToGetWorkloadIds(IEnumerable<string> allProjec
73
79
isUserError : false ) ;
74
80
}
75
81
76
- var targetResult = targetOutputs [ "_GetRequiredWorkloads" ] ;
82
+ var targetResult = targetOutputs [ GetRequiredWorkloadsTargetName ] ;
77
83
allWorkloadId . AddRange ( targetResult . Items . Select ( item => new WorkloadId ( item . ItemSpec ) ) ) ;
78
84
}
79
85
You can’t perform that action at this time.
0 commit comments