Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to rename the "My Project" folder in a Visual Studio 2010 project?

I have a VB.NET project in Visual Studio 2010 for an Excel Add-In.

I use the "My" namespace, and in general it seems that the "My Project" folder contains configuration information about the project.

My problem is that I need to change the name of this folder, because my version manager system won't accept spaces in file or folder names.

Is it possible? If yes, how?


Edit: There is a hacky way to do it, by renaming the folder and changing all references in the .vbproj file. However, the may work for a command line generation, but it won't work the next time the project will be opened in Visual Studio. The IDE will create a new "My Project" folder, and complain that it can't find the settings in it.

I'm looking for a way to rename it so that Visual Studio would accept it correctly.

like image 628
Gnoupi Avatar asked Nov 22 '10 10:11

Gnoupi


People also ask

How do I rename a folder outside of Visual Studio?

Rename the folder (s) outside Visual Studio. Open the solution in Visual Studio, ignoring the warnings. Go through all unavailable projects and click “F4” key view project properties. Set the file path to the new folder location. Right-click > Reload project. Change the display name of the project. Right-click > Rename.

How do I change the name of a Visual Studio project?

In Visual Studio, select menu File► Open Project. Drill into the new folder you just renamed and open the .csproj file (located in the child folder). Right-click the project name and rename it to what you want.

How do I rename a project?

Move the Project folder to its new location (don't rename anything yet) In Solution Explorer, rename the Project / Solution. Close (and save) the newly-renamed project.

How do I move a project from one folder to another?

Rename the folder (s) outside Visual Studio. Open the solution in Visual Studio, ignoring the warnings. Go through all unavailable projects and click “F4” key view project properties. Set the file path to the new folder location. Right-click > Reload project.


2 Answers

In fact it is possible, but seems to be undocumented.

Open the project file (*.vbproj) in a text editor, and add the following line inside the first <PropertyGroup> element:

<AppDesignerFolder>NewName</AppDesignerFolder>

Now when Visual Studio regenerates the folder, it will call it "NewName", and anything it generates that it would put in My Project (such as AssemblyInfo.vb) will be put there.

You can then move (in Explorer, not Visual Studio) the contents of "My Project" to that folder, delete "My Project", and everything should work as expected.

like image 83
gurch Avatar answered Nov 15 '22 07:11

gurch


The „My Project“ convention is part of Visual Studios project and item templates and although you can change them, I wouldn’t do it. It’s not just changing one project template. You have to change all related item templates.

And there are problems in the future…

…with the update wizard of the next visual studio release

…with future project and item templates...

I wouldn’t do it!

like image 43
Dirk Brockhaus Avatar answered Nov 15 '22 08:11

Dirk Brockhaus