public async static Task BackgroundUpdateAdvertisingManifestsAsync() { try { var reporter = new NullReporter(); var dotnetPath = Path.GetDirectoryName(Environment.ProcessPath); var sdkVersion = Product.Version; var workloadManifestProvider = new SdkDirectoryWorkloadManifestProvider(dotnetPath, sdkVersion); var workloadResolver = WorkloadResolver.Create(workloadManifestProvider, dotnetPath, sdkVersion); 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); var userHome = CliFolderPathCalculator.DotnetHomePath; var manifestUpdater = new WorkloadManifestUpdater(reporter, workloadManifestProvider, workloadResolver, nugetPackageDownloader, userHome, tempPackagesDir.Value); await manifestUpdater.BackgroundUpdateAdvertisingManifestsWhenRequiredAsync(); } catch (Exception) { // Never surface messages on background updates } }
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); var workloadRecordRepo = WorkloadInstallerFactory.GetWorkloadInstaller(reporter, new SdkFeatureBand(sdkVersion), workloadResolver, Cli.VerbosityOptions.normal, userProfileDir) .GetWorkloadInstallationRecordRepository(); return(new WorkloadManifestUpdater(reporter, workloadResolver, nugetPackageDownloader, userProfileDir, tempPackagesDir.Value, workloadRecordRepo)); }