private void Button_AssociationExtension_Click(object sender, RoutedEventArgs e) { try { string iconPath = $"{Path.GetDirectoryName(Application.ResourceAssembly.Location)}\\Extension.ico"; if (File.Exists(iconPath) == false) { iconPath = null; } Registry.AssociateExtension(".baclist", App.ProgramName, Application.ResourceAssembly.Location, iconPath); } catch (Exception ex) { MessageBox.Show(ex.Message, Title, MessageBoxButton.OK, MessageBoxImage.Error); } }