@@ -42,26 +42,13 @@ internal static string GetWorkloadsVersion(WorkloadInfoHelper workloadInfoHelper
42
42
var versionInfo = workloadInfoHelper . ManifestProvider . GetWorkloadVersion ( ) ;
43
43
44
44
// The explicit space here is intentional, as it's easy to miss in localization and crucial for parsing
45
- return versionInfo . Version + ( versionInfo . VersionNotInstalledMessage is not null ? ' ' + Workloads . Workload . List . LocalizableStrings . WorkloadVersionNotInstalledShort : string . Empty ) ;
45
+ return versionInfo . Version + ( versionInfo . IsInstalled ? string . Empty : ' ' + Workloads . Workload . List . LocalizableStrings . WorkloadVersionNotInstalledShort ) ;
46
46
}
47
47
48
48
internal static void ShowWorkloadsInfo ( ParseResult parseResult = null , WorkloadInfoHelper workloadInfoHelper = null , IReporter reporter = null , string dotnetDir = null , bool showVersion = true )
49
49
{
50
50
workloadInfoHelper ??= new WorkloadInfoHelper ( parseResult != null ? parseResult . HasOption ( SharedOptions . InteractiveOption ) : false ) ;
51
51
reporter ??= Utils . Reporter . Output ;
52
- var globalJsonInformation = workloadInfoHelper . ManifestProvider . GetGlobalJsonInformation ( ) ;
53
- if ( globalJsonInformation ? . WorkloadVersionInstalled == false )
54
- {
55
- reporter . WriteLine ( string . Format ( Workloads . Workload . List . LocalizableStrings . WorkloadSetFromGlobalJsonNotInstalled , globalJsonInformation . GlobalJsonVersion , globalJsonInformation . GlobalJsonPath ) ) ;
56
- return ;
57
- }
58
-
59
- IEnumerable < WorkloadId > installedList = workloadInfoHelper . InstalledSdkWorkloadIds ;
60
- InstalledWorkloadsCollection installedWorkloads = workloadInfoHelper . AddInstalledVsWorkloads ( installedList ) ;
61
- string dotnetPath = dotnetDir ?? Path . GetDirectoryName ( Environment . ProcessPath ) ;
62
-
63
-
64
-
65
52
var versionInfo = workloadInfoHelper . ManifestProvider . GetWorkloadVersion ( ) ;
66
53
67
54
void WriteUpdateModeAndAnyError ( string indent = "" )
@@ -70,10 +57,13 @@ void WriteUpdateModeAndAnyError(string indent = "")
70
57
var workloadSetsString = useWorkloadSets == true ? "workload sets" : "loose manifests" ;
71
58
reporter . WriteLine ( indent + string . Format ( CommonStrings . WorkloadManifestInstallationConfiguration , workloadSetsString ) ) ;
72
59
73
- var additionalMessage = versionInfo . VersionNotInstalledMessage ?? versionInfo . UpdateModeMessage ;
74
- if ( additionalMessage != null )
60
+ if ( ! versionInfo . IsInstalled )
75
61
{
76
- reporter . WriteLine ( indent + additionalMessage ) ;
62
+ reporter . WriteLine ( indent + string . Format ( CommonStrings . WorkloadSetFromGlobalJsonNotInstalled , versionInfo . Version , versionInfo . GlobalJsonPath ) ) ;
63
+ }
64
+ else if ( versionInfo . WorkloadSetsEnabledWithoutWorkloadSet )
65
+ {
66
+ reporter . WriteLine ( indent + CommonStrings . ShouldInstallAWorkloadSet ) ;
77
67
}
78
68
}
79
69
@@ -85,37 +75,44 @@ void WriteUpdateModeAndAnyError(string indent = "")
85
75
reporter . WriteLine ( ) ;
86
76
}
87
77
88
- if ( installedWorkloads . Count == 0 )
89
- {
90
- reporter . WriteLine ( CommonStrings . NoWorkloadsInstalledInfoWarning ) ;
91
- }
92
- else
78
+ if ( versionInfo . IsInstalled )
93
79
{
94
- var manifestInfoDict = workloadInfoHelper . WorkloadResolver . GetInstalledManifests ( ) . ToDictionary ( info => info . Id , StringComparer . OrdinalIgnoreCase ) ;
80
+ IEnumerable < WorkloadId > installedList = workloadInfoHelper . InstalledSdkWorkloadIds ;
81
+ InstalledWorkloadsCollection installedWorkloads = workloadInfoHelper . AddInstalledVsWorkloads ( installedList ) ;
82
+ string dotnetPath = dotnetDir ?? Path . GetDirectoryName ( Environment . ProcessPath ) ;
95
83
96
- foreach ( var workload in installedWorkloads . AsEnumerable ( ) )
84
+ if ( installedWorkloads . Count == 0 )
97
85
{
98
- var workloadManifest = workloadInfoHelper . WorkloadResolver . GetManifestFromWorkload ( new WorkloadId ( workload . Key ) ) ;
99
- var workloadFeatureBand = manifestInfoDict [ workloadManifest . Id ] . ManifestFeatureBand ;
86
+ reporter . WriteLine ( CommonStrings . NoWorkloadsInstalledInfoWarning ) ;
87
+ }
88
+ else
89
+ {
90
+ var manifestInfoDict = workloadInfoHelper . WorkloadResolver . GetInstalledManifests ( ) . ToDictionary ( info => info . Id , StringComparer . OrdinalIgnoreCase ) ;
91
+
92
+ foreach ( var workload in installedWorkloads . AsEnumerable ( ) )
93
+ {
94
+ var workloadManifest = workloadInfoHelper . WorkloadResolver . GetManifestFromWorkload ( new WorkloadId ( workload . Key ) ) ;
95
+ var workloadFeatureBand = manifestInfoDict [ workloadManifest . Id ] . ManifestFeatureBand ;
100
96
101
- const int align = 10 ;
102
- const string separator = " " ;
97
+ const int align = 10 ;
98
+ const string separator = " " ;
103
99
104
- reporter . WriteLine ( $ " [{ workload . Key } ]") ;
100
+ reporter . WriteLine ( $ " [{ workload . Key } ]") ;
105
101
106
- reporter . Write ( $ "{ separator } { CommonStrings . WorkloadSourceColumn } :") ;
107
- reporter . WriteLine ( $ " { workload . Value , align } ") ;
102
+ reporter . Write ( $ "{ separator } { CommonStrings . WorkloadSourceColumn } :") ;
103
+ reporter . WriteLine ( $ " { workload . Value , align } ") ;
108
104
109
- reporter . Write ( $ "{ separator } { CommonStrings . WorkloadManifestVersionColumn } :") ;
110
- reporter . WriteLine ( $ " { workloadManifest . Version + '/' + workloadFeatureBand , align } ") ;
105
+ reporter . Write ( $ "{ separator } { CommonStrings . WorkloadManifestVersionColumn } :") ;
106
+ reporter . WriteLine ( $ " { workloadManifest . Version + '/' + workloadFeatureBand , align } ") ;
111
107
112
- reporter . Write ( $ "{ separator } { CommonStrings . WorkloadManifestPathColumn } :") ;
113
- reporter . WriteLine ( $ " { workloadManifest . ManifestPath , align } ") ;
108
+ reporter . Write ( $ "{ separator } { CommonStrings . WorkloadManifestPathColumn } :") ;
109
+ reporter . WriteLine ( $ " { workloadManifest . ManifestPath , align } ") ;
114
110
115
- reporter . Write ( $ "{ separator } { CommonStrings . WorkloadInstallTypeColumn } :") ;
116
- reporter . WriteLine ( $ " { WorkloadInstallType . GetWorkloadInstallType ( new SdkFeatureBand ( Utils . Product . Version ) , dotnetPath ) . ToString ( ) , align } "
117
- ) ;
118
- reporter . WriteLine ( "" ) ;
111
+ reporter . Write ( $ "{ separator } { CommonStrings . WorkloadInstallTypeColumn } :") ;
112
+ reporter . WriteLine ( $ " { WorkloadInstallType . GetWorkloadInstallType ( new SdkFeatureBand ( Utils . Product . Version ) , dotnetPath ) . ToString ( ) , align } "
113
+ ) ;
114
+ reporter . WriteLine ( "" ) ;
115
+ }
119
116
}
120
117
}
121
118
0 commit comments