public WorkloadListHelper( VerbosityOptions verbosity = VerbosityOptions.normal, string targetSdkVersion = null, bool?verifySignatures = null, IReporter reporter = null, IWorkloadInstallationRecordRepository workloadRecordRepo = null, string currentSdkVersion = null, string dotnetDir = null, string userProfileDir = null, IWorkloadResolver workloadResolver = null ) { string dotnetPath = dotnetDir ?? Path.GetDirectoryName(Environment.ProcessPath); ReleaseVersion currentSdkReleaseVersion = new(currentSdkVersion ?? Product.Version); _currentSdkFeatureBand = new SdkFeatureBand(currentSdkReleaseVersion); _targetSdkVersion = targetSdkVersion; userProfileDir ??= CliFolderPathCalculator.DotnetUserProfileFolderPath; var workloadManifestProvider = new SdkDirectoryWorkloadManifestProvider(dotnetPath, string.IsNullOrWhiteSpace(_targetSdkVersion) ? currentSdkReleaseVersion.ToString() : _targetSdkVersion, userProfileDir); WorkloadResolver = workloadResolver ?? NET.Sdk.WorkloadManifestReader.WorkloadResolver.Create( workloadManifestProvider, dotnetPath, currentSdkReleaseVersion.ToString(), userProfileDir); WorkloadRecordRepo = workloadRecordRepo ?? WorkloadInstallerFactory.GetWorkloadInstaller(reporter, _currentSdkFeatureBand, WorkloadResolver, verbosity, userProfileDir, verifySignatures ?? !SignCheck.IsDotNetSigned(), elevationRequired: false).GetWorkloadInstallationRecordRepository(); }
private static WorkloadManifestUpdater GetInstance(string userProfileDir) { var reporter = new NullReporter(); var dotnetPath = Path.GetDirectoryName(Environment.ProcessPath); var sdkVersion = Product.Version; var workloadManifestProvider = new SdkDirectoryWorkloadManifestProvider(dotnetPath, sdkVersion, userProfileDir); var workloadResolver = WorkloadResolver.Create(workloadManifestProvider, dotnetPath, sdkVersion, userProfileDir); var tempPackagesDir = new DirectoryPath(Path.Combine(Path.GetTempPath(), "dotnet-sdk-advertising-temp")); var nugetPackageDownloader = new NuGetPackageDownloader(tempPackagesDir, filePermissionSetter: null, new FirstPartyNuGetPackageSigningVerifier(tempPackagesDir, new NullLogger()), new NullLogger(), reporter, verifySignatures: SignCheck.IsDotNetSigned()); var workloadRecordRepo = WorkloadInstallerFactory.GetWorkloadInstaller(reporter, new SdkFeatureBand(sdkVersion), workloadResolver, Cli.VerbosityOptions.normal, userProfileDir, verifySignatures: false) .GetWorkloadInstallationRecordRepository(); return(new WorkloadManifestUpdater(reporter, workloadResolver, nugetPackageDownloader, userProfileDir, tempPackagesDir.Value, workloadRecordRepo)); }