Skip to content

Commit cbe7381

Browse files
authored
feat(solution): remove and re-add project during rename (#28)
1 parent 124accb commit cbe7381

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/CodingWithCalvin.ProjectRenamifier/Commands/RenamifyProjectCommand.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ private void RenameProject(Project project, DTE2 dte)
8080
var newName = dialog.NewProjectName;
8181
var projectFilePath = project.FullName;
8282

83+
// Remove project from solution before file operations
84+
dte.Solution.Remove(project);
85+
8386
// Update RootNamespace and AssemblyName in .csproj
8487
ProjectFileService.UpdateProjectFile(projectFilePath, currentName, newName);
8588

@@ -92,9 +95,11 @@ private void RenameProject(Project project, DTE2 dte)
9295
// Rename parent directory if it matches the old project name
9396
projectFilePath = ProjectFileService.RenameParentDirectoryIfMatches(projectFilePath, currentName, newName);
9497

98+
// Re-add project to solution with new path
99+
dte.Solution.AddFromFile(projectFilePath);
100+
95101
// TODO: Implement remaining rename operations
96102
// See open issues for requirements:
97-
// - #22: Remove and re-add project to solution
98103
// - #23: Update project references
99104
// - #9: Update using statements across solution
100105
// - #11: Solution folder support

0 commit comments

Comments
 (0)