dotnet / dotnet/project-system

Renaming aspx/razor/etc files won't rename their classes

Open
#9,292 2 comments 0 reactions 1 assignee Claimed by @drewnoakes View on GitHub
Feature-Solution-Explorer Triage-Approved
Dominant language
C#
Stars
1k
Forks
415
PR merge metrics
No merged PRs in 30d

Description

Inspired by [AB#1886228](https://devdiv.visualstudio.com/0bdbc590-a062-4c3f-b0f6-9383f67865ee/_workitems/edit/1886228)

![image](https://github.com/dotnet/project-system/assets/350947/1d8258aa-5de9-46f2-a2f5-56e6ac223e7f)

1. Create a .NET WPF application
2. In Solution Explorer, rename `MainWindow.xaml` to `MainWindow2.xaml`
3. `MainWindow.xaml.cs` is also renamed, however the corresponding type is not renamed

This also works for `.razor`/`.razor.cs` files. Possibly others. In the case of razor, the mismatched type and file names cause the generated code to become disconnected from the page itself, requiring manual renames to fix.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.