private void WebProjectFileBrowse(object sender, RoutedEventArgs e) { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); if (string.IsNullOrWhiteSpace(WebProjectFile)) { dlg.FileName = "*.csproj"; dlg.InitialDirectory = Path.GetDirectoryName(GeneratorConfig.GetConfigurationFilePath()); } else { var webProjectFile = Path.GetFullPath(WebProjectFile); dlg.FileName = Path.GetFileName(webProjectFile); dlg.InitialDirectory = Path.GetDirectoryName(webProjectFile); } Nullable <bool> result = dlg.ShowDialog(); if (result == true) { WebProjectFile = GeneratorConfig.GetRelativePath(dlg.FileName, AppDomain.CurrentDomain.BaseDirectory); config.Save(); } }