public static void FirstOrEmpty() { var launchSettings = VisualStudioLaunchSettings.FromCaller(); var profiles = launchSettings.GetProfiles(); var profile = profiles.FirstOrEmpty(); WriteOut.EnvironmentalVariables(profile); }
public static void UseNamedProfile() { var launchSettings = VisualStudioLaunchSettings.FromCaller(); var profiles = launchSettings.GetProfiles(); var(exists, profile) = profiles.Use("does-not-exist"); try { // You can not just use it. If the profile is missing, it will blow up! WriteOut.EnvironmentalVariables(profile); } catch (NullReferenceException) { WriteOut.Line("The profile was null and it caused an exception!"); } }