Take the 2-minute tour ×

In Visual Studio (I'm using 2010), When you create your own class/struct, where the filename and class name/struct name matches, and then attempt to rename the file, Visual Studio asks if you want to update the class name / struct name and all references to the class / struct.

When I import a code file into the project, which follows the naming convention (file name and class name / struct name are the same) and then try to rename the file, Visual Studio does not ask me to update the class / struct and references to it...why is it only working for files that I create as opposed to files that I import?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

You still can rename the class using refactoring to make sure it updates all references, if it's what you're looking for.

It's not an answer though, if you really just want to know why it doesn't work ^^

Maybe the file have to compile correctly for this trick to work ?

share|improve this answer
Basically, I am writing a Win32 Native API library for C#, and I have a whole load of exports (functions, function pointers, structs, etc). The code compiles, and I'm glad it does because I was able to use .NET Reflector to do a lot of the donkey work for me. However the problem comes when trying to comply with C# stylistic conventions. Since C++ seems to like having things named like: "CRYPT_ATTRIBUTE" and "_pure_functioncall", I wanted to rename the files like so "CryptAttribute" / "PureFunctionCall" to make all the types, delegates etc, C# friendly. However it's a monumental task! –  series0ne Jul 20 '12 at 15:55
Guess you could automate this. Not an easy task, but a possible one. Perhaps the Roslyn CTP is advanced enough. VisualStudio automation (envdte) may help you too, to manipulate your projects and files. –  Vivien Ruiz Jul 23 '12 at 9:15

Your Answer


