public static void AddBackupStep(this IExtensionServiceCollection services) { if (services is null) { throw new ArgumentNullException(nameof(services)); } services.Services.AddUpgradeStep <BackupStep>(); services.AddExtensionOption <BackupOptions>("Backup"); }
public static void AddConfigUpdaterStep(this IExtensionServiceCollection services) { if (services is null) { throw new ArgumentNullException(nameof(services)); } services.Services.AddUpgradeStep <ConfigUpdaterStep>(); services.AddExtensionOption <ConfigUpdaterOptions>(ConfigUpdaterOptionsSectionName); services.Services.AddDefaultConfigUpdaters(); }
public void AddServices(IExtensionServiceCollection services) { if (services is null) { throw new ArgumentNullException(nameof(services)); } services.Services.AddTransient <IDependencyAnalyzer, LooseDependencyAnalyzer>(); services.Services.AddScoped <NuGetPackageLookup>(); services.AddExtensionOption <LooseDependencyOptions>("LooseDependencies"); }
public void AddServices(IExtensionServiceCollection services) { if (services is null) { throw new ArgumentNullException(nameof(services)); } services.Services.AddTransient <ITargetFrameworkSelectorFilter, WindowsSdkTargetFrameworkSelectorFilter>(); services.Services.AddTransient <IComponentIdentifier, WindowsComponentIdentifier>(); services.Services.AddTransient <IAnalyzeResultProvider, WinformsResultProvider>(); services.Services.AddUpgradeStep <WindowsDesktopUpdateStep>(); services.AddExtensionOption <WinUIOptions>(WinUIOptions.Name); services.Services.AddWinformsUpdaterStep(); services.Services.AddWinUIUpdateSteps(); }
public static void AddPackageUpdaterStep(this IExtensionServiceCollection services) { if (services is null) { throw new System.ArgumentNullException(nameof(services)); } services.Services.AddUpgradeStep <PackageUpdaterPreTFMStep>(); services.Services.AddUpgradeStep <PackageUpdaterStep>(); services.Services.AddTransient <IDependencyAnalyzerRunner, DependencyAnalyzerRunner>(); services.Services.AddTransient <IAnalyzeResultProvider, PackageAnalyzerResultProvider>(); services.AddExtensionOption <PackageUpdaterOptions>(PackageUpdaterOptionsSectionName) .MapFiles <NuGetPackageMap[]>(t => Path.Combine(t.PackageMapPath, PackageMapExtension)); }
public static void AddSolutionSteps(this IExtensionServiceCollection services) { if (services is null) { throw new ArgumentNullException(nameof(services)); } services.Services.AddSingleton <IEntrypointResolver, EntrypointResolver>(); services.Services.AddUpgradeStep <CurrentProjectSelectionStep>(); services.Services.AddUpgradeStep <NextProjectStep>(); services.Services.AddUpgradeStep <FinalizeSolutionStep>(); services.Services.AddUpgradeStep <EntrypointSelectionStep>(); services.AddExtensionOption <SolutionOptions>("Solution"); }
public static IServiceCollection AddTemplateInserterStep(this IExtensionServiceCollection services) { if (services is null) { throw new System.ArgumentNullException(nameof(services)); } services.Services.AddSingleton <TemplateProvider>(); services.Services.AddUpgradeStep <TemplateInserterStep>(); services.Services.AddOptions <JsonSerializerOptions>() .Configure(o => o.Converters.Add(new JsonStringProjectItemTypeConverter())); services.AddExtensionOption <TemplateInserterOptions>(TemplateInserterOptionsSectionName) .MapFiles <TemplateConfiguration>(t => t.TemplateConfigFiles); return(services.Services); }
public static void AddSourceUpdaterStep(this IExtensionServiceCollection services) { if (services is null) { throw new ArgumentNullException(nameof(services)); } services.Services.AddUpgradeStep <SourceUpdaterStep>(); services.Services.AddTransient <IAnalyzeResultProvider, DiagnosticAnalyzerResultProvider>(); services.Services.AddTransient <IRoslynDiagnosticProvider, RoslynDiagnosticProvider>(); services.AddExtensionOption <SourceUpdaterOptions>(SourceUpdaterOptionsSection); // TODO - In the future, this should map the options to IEnumerable<AdditionalText> using // extension mapping APIs. Currently, though, extension option mapping only works // with json serialized files. services.Services.AddTransient <IEnumerable <AdditionalText> >(sp => { var options = sp.GetRequiredService <IOptions <ICollection <SourceUpdaterOptions> > >(); return(ExpandAdditionalTexts(options.Value)); }); }
/// <summary> /// Registers services needed for the FindReplaceStep sample extension in /// Upgrade Assistant's dependency injection container. /// </summary> /// <param name="services">A configuration object containing the service collection /// to register services in, the extension's configuration file, and a file provider /// for retrieving extension files.</param> public void AddServices(IExtensionServiceCollection services) { if (services is null) { throw new ArgumentNullException(nameof(services)); } // Add the upgrade step to Upgrade Assistant's DI container so that it // will be used by the tool. services.Services.AddUpgradeStep <FindReplaceUpgradeStep>(); // This registers a type read from extension configuration. Using // AddExtensionOption (instead of registering an option using the // IExtensionServiceCollection's Configuration property) allows the // extension system to load the specified option from *all* extension, // not just the one registering it. // // Extensions can get the configured option from DI by requesting // IOptions<AuthorsPropertyOptions> (to get only the value of the option // specified by the most recently registered extension that includes the // option) or IOptions<ICollection<AuthorsPropertyOptions>> to get a collection // of all options of this type registered by any extensions. services.AddExtensionOption <FindReplaceOptions>(FindReplaceOptionsSectionName); }