Visual Studio > Renaming a Project File


It is a best practice to rename your project files within your Visual Studio project. As your project grows having a number of files named Form1, Form2, Form3, etc will make finding the correct code difficult.

When renaming a file it is best to do so through the Solution Explorer. This will ensure that the filename and the class name match (which is also a best practice in .NET code).

Renaming a Project File

Renaming a Project File

When the dialog appears, be sure to click Yes. This will go through your project and update any references to match the new name.

When finished, you should build your project (Build > Build Solution or CTRL+SHIFT+B) to ensure the rename didn’t cause any problems.