title: How to rename solution, solution folder, project folder, package/filter folder and vcxproj file in Visual Studio 2012
body: <p>I've having problems doing any of these above with my game project. There are plenty of answer online already and I looked through all of them but they didn't work for me or having different scenario. Here is my situation:</p>
  
  <p><img src="https://i.stack.imgur.com/rL1of.png" alt="This is my Solution"></p>
  
  <p>This is what my solution looks like. I changed the project name from <strong><code>X-Power</code></strong> to <strong><code>Neo_Elements</code></strong> within the visual studio, which works. But it doesn't affect the actual physical folder.</p>
  
  <p>The physical file path and name for the .vcxproj file is <code>...\Neo_Elements\WorldScrollingGame\WorldScrollingGame.vcxproj</code>.</p>
  
  <p>The physical file path and name for the .sln file is 
  <code>...\Neo_Elements\X-Power.sln</code></p>
  
  <p>What I want to do:</p>
  
  <ol>
  <li><p>Rename the solution to <strong><code>Neo_Elements</code></strong> (hence the <code>.sln</code> file will change accordingly)</p></li>
  <li><p>Change the file path to <code>...\Neo_Elements\Neo_Elements\...</code></p></li>
  <li><p>Rename the .vcxproj file to <code>Neo_Elements.vcxproj</code></p></li>
  </ol>
  
  <p>So after the change the .sln file path and name should be
  <code>...\Neo_Elements\Neo_Elements.sln</code></p>
  
  <p>the .vcxproj file path and name should be <code>...\Neo_Elements\Neo_Elements\Neo_Elements.vcxproj</code></p>
  
  <p>The solution and project name will both be <strong><code>Neo_Elements</code></strong></p>
  
  <p>What I did:</p>
  
  <ol>
  <li>Rename the solution within Visual studio by F2 on the solution name.</li>
  </ol>
  
  <p>What Happened:</p>
  
  <p>The project no longer builds and creates bunch of compile error like this:</p>
  
  <pre><code>fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory
  fatal error C1083: Cannot open include file: 'resource.h': No such file or directory
  </code></pre>
  
  <p>I didn't even change the physical folder and I had no idea why the file cannot be found, and the location of the file missing seemed totally random to me. (not only those under <code>\WorldScrollingGame</code> but also some at deeper levels. Also lots of files were affected but only few files cannot be found).
  When I tried to change the solution name back to <strong><code>X-Power</code></strong> it turns out that I cannot. It says
  "The solution cannot be renamed because solution files with the specified name already exist", despite the fact that there is no <code>X-Power.sln</code> anymore. Nevertheless I've been completely stuck here and had to restore the entire solution from a backup (or change the name of .sln file manually in windows explorer). First attempt failed.</p>
  
  <p>Then I started trying the second by change project folder outside VS. </p>
  
  <p>What I did:</p>
  
  <p>I followed <a href="https://stackoverflow.com/questions/211241/how-do-i-rename-a-project-folder-from-within-visual-studio">this link</a>: closed VS, renamed the project director outside VS, edited .sln in text editor changing <code>"X-Power", "WorldScrollingGame\WorldScrollingGame.vcxproj"</code> to <code>"X-Power", "Neo_Elements\WorldScrollingGame.vcxproj"</code> (strangely the <strong><code>X-Power</code></strong> should be <strong><code>Neo_Elements</code></strong> since I edited the project name within VS, but somehow it didn't reflect the change here, unless this isn't a reflection of project name which by no means should be the case according to that link. But I didn't want to mess with the  solution name now because of what happened before). </p>
  
  <p>What Happened:</p>
  
  <p>It turns out I still receive bunch of compilation error similar to the one I got for my first attempt, no idea how to solve those.</p>
  
  <p>So I didn't bother try the 3rd one since I don't even know how to</p>
  
  <p>Please help! Really can't get around with these few.</p>
  
  <p>Edit:
  I know it might be better just to start of a new one and migrate all the files, but I've been unable to do the renaming in any situation before -- even a single solution renaming or a single project directory renaming. So I want to take this chance and figure out how this actually work, as it seemed to have worked for a lot of people</p>