public override void ExecuteCommandImpl(object sender, EventArgs args, IVsUIShell uiShell) { var project = projectManager.SelectedProject; string selectedMethodName = projectManager.MethodName; string serverMethodFolderPath = projectManager.ServerMethodFolderPath; string selectedFolderPath = projectManager.SelectedFolderPath; string projectConfigPath = projectManager.ProjectConfigPath; var projectConfiguration = projectConfigurationManager.Load(projectConfigPath); MethodInfo methodInformation = projectConfiguration.MethodInfos.FirstOrDefault(m => m.MethodName == selectedMethodName); if (methodInformation == null) { throw new Exception($"Configurations for the {selectedMethodName} method not found."); } var view = dialogFactory.GetCreatePartialClassView(uiShell, projectConfiguration.UseVSFormatting); var viewResult = view.ShowDialog(); if (viewResult?.DialogOperationResult != true) { return; } string partialPath = selectedFolderPath.Substring(serverMethodFolderPath.IndexOf(serverMethodFolderPath) + serverMethodFolderPath.Length); partialPath = Path.Combine(partialPath, viewResult.FileName); if (methodInformation.PartialClasses.Contains(partialPath, StringComparer.InvariantCultureIgnoreCase)) { throw new Exception($"Partial element already exist."); } ICodeProvider codeProvider = codeProviderFactory.GetCodeProvider(project.CodeModel.Language, projectConfiguration); CodeInfo partialCodeInfo = codeProvider.CreatePartialCodeInfo(methodInformation, viewResult.FileName, viewResult.IsUseVSFormattingCode); projectManager.AddItemTemplateToProjectNew(partialCodeInfo, true, 0); methodInformation.PartialClasses.Add(partialCodeInfo.Path); projectConfiguration.UseVSFormatting = viewResult.IsUseVSFormattingCode; projectConfigurationManager.Save(projectManager.ProjectConfigPath, projectConfiguration); }