public override async Task <string?> OnSetPropertyValueAsync(string propertyName, string unevaluatedPropertyValue, IProjectProperties defaultProperties, IReadOnlyDictionary <string, string>?dimensionalConditions = null)
        {
            ILaunchSettings launchSettings = await _launchSettingsProvider.WaitForFirstSnapshot();

            IWritableLaunchSettings writableLaunchSettings = launchSettings.ToWritableLaunchSettings();

            if (SetPropertyValue(propertyName, unevaluatedPropertyValue, writableLaunchSettings))
            {
                await _launchSettingsProvider.UpdateAndSaveSettingsAsync(writableLaunchSettings.ToLaunchSettings());
            }

            // We've intercepted the "set" operation and redirected it to the launch settings.
            // Return "null" to indicate that the value should _not_ be set in the project file
            // as well.
            return(null);
        }
        public override async Task <string?> OnSetPropertyValueAsync(string propertyName, string unevaluatedPropertyValue, IProjectProperties defaultProperties, IReadOnlyDictionary <string, string>?dimensionalConditions = null)
        {
            ConfiguredProject?configuredProject = await _project.GetSuggestedConfiguredProjectAsync();

            IPropertyPagesCatalogProvider?catalogProvider = configuredProject?.Services.PropertyPagesCatalog;

            if (catalogProvider == null)
            {
                return(null);
            }

            IPropertyPagesCatalog catalog = await catalogProvider.GetCatalogAsync(PropertyPageContexts.Project);

            Rule?rule = catalog.GetSchema(unevaluatedPropertyValue);

            if (rule == null)
            {
                return(null);
            }

            if (rule.Metadata.TryGetValue("CommandName", out object pageCommandNameObj) &&
                pageCommandNameObj is string pageCommandName)
            {
                _projectThreadingService.RunAndForget(async() =>
                {
                    // Infinite timeout means this will not actually be null.
                    ILaunchSettings?launchSettings = await _launchSettingsProvider.WaitForFirstSnapshot(Timeout.Infinite);
                    Assumes.NotNull(launchSettings);

                    IWritableLaunchSettings writableLaunchSettings = launchSettings.ToWritableLaunchSettings();
                    IWritableLaunchProfile?activeProfile           = writableLaunchSettings.ActiveProfile;
                    if (activeProfile != null)
                    {
                        activeProfile.CommandName = pageCommandName;

                        await _launchSettingsProvider.UpdateAndSaveSettingsAsync(writableLaunchSettings.ToLaunchSettings());
                    }
                },
                                                      options: ForkOptions.HideLocks,
                                                      unconfiguredProject: _project);
            }

            return(null);
        }