7

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.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Gnoupi
  • 4,715
  • 5
  • 34
  • 50
  • @Gnoupi - What version control system are you using? It might be easier to switch to something that does support spaces. – Geoff Appleford Nov 23 '10 at 09:12
  • @geoff - I actually got known that it was more a matter of some legacy code put around the version control system, than of the base system itself. I agree that it would be easier to switch, but the choice is not given, unfortunately. – Gnoupi Nov 23 '10 at 09:34
  • Could you provide more of you file structure here? – Michael Paulukonis Nov 23 '10 at 14:36
  • 1
    @Michael: I don't think the file structure is relevant. He's talking about a special folder/convention used by VB.NET. It's not something he created, and not something you find in the file system. – Cody Gray - on strike Nov 24 '10 at 13:07
  • Yeah, I'm not seeing it in Visual Studio with C#. – Michael Paulukonis Nov 24 '10 at 14:03
  • @Code - actually, it is something you find in the filesystem. That's the point. The folder is created there too. It appears indeed to be linked to VB.NET, thank you for editing my question to emphasize that. – Gnoupi Nov 24 '10 at 14:41
  • See also http://stackoverflow.com/questions/211241/how-do-i-rename-a-project-folder-from-within-visual-studio (I retract my dupe flag as this isn't the same thing). – Tim Abell May 24 '14 at 20:18

5 Answers5

10

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.

gurch
  • 116
  • 1
  • 4
  • Indeed, it works. On an existing project, you still have to replace all occurrences of the previous folder name by the new one in this file, though. All references to individual files contain this strong reference, so it keeps them in this place. After replacing the last one, it worked. Thanks! – Gnoupi Sep 23 '11 at 09:19
2

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!

Dirk Brockhaus
  • 4,922
  • 3
  • 38
  • 47
  • Yes, it seems that there is no "good way" to change that, only hacks which won't work fully. I will accept this answer, as such. Hopefully, for my personal problem, we have found that the "space issue" was only for filenames, not folder names, *for some reason*. So it's good enough for my own case. – Gnoupi Nov 24 '10 at 14:46
0

I renamed the folder with the project in, and then opened the solution. It complained that the project was not found so I then removed the project from the solution and then added it back by adding an existing project ( from the new directory ). Worked OK for me.

0

Simply delete the project solution (.sln) file

Rename your folder

Open the .VBProj file in your folder

Select Save

it will create a new solution file you can place wherever you I keep mine one node up from the project folder.

Nothing complicated here.

Tim Miltz

Tim Miltz
  • 41
  • 2
0

Are you referring to the folder that the entire project is in?

  1. Close the project.
  2. make backup of the project
  3. change the name of the folder to <new-name>
  4. open the .sln file
  5. change all instances of My Project to <new-name>
  6. reopen project
Michael Paulukonis
  • 9,020
  • 5
  • 48
  • 68
  • I'm talking about the folder named "My Project", inside my actual project folder (same level as the .vbproj file). It contains the application parameters, the assembly info, etc. – Gnoupi Nov 23 '10 at 08:56
  • @Michael - same with modifying in the sln as well. No matter what is set in the vbproj and sln files, VS2010 will expect a "my project" folder, the next time you open the project in it. This solution would work probably for a project used only for code compilation with msbuild, but not if opened in VS. – Gnoupi Nov 24 '10 at 14:43
  • This must be a VB thing, because it does not happen for C# in VS – Michael Paulukonis Nov 24 '10 at 15:15
  • Ugh. I hate that pseudo-folksy my-followed-by-a-space thing that MS has. It doesn't endear me to the technology when I'm constantly having to put quotation marks around paths that I paste into shell or Start >> Run. – Michael Paulukonis Nov 24 '10 at 15:16
  • @Michael - just for information, don't forget to add the "@nickname" when you want to answer to someone, so they gt the notification. Even if this is my question, I won't get notification for a comment on your answer unless you put explicitly the "@". – Gnoupi Nov 25 '10 at 08:44