Sign in to follow this  
Chicktopus

VS 2010 Source Directories

Recommended Posts

Hi guys, I'm a little stuck on this one.

Basically I just need to change the default source code directory of a project in Visual Studio 2010, but I've had a look through all the project properties and such and can't find anywhere to change it. Any thoughts?

Share this post


Link to post
Share on other sites
What do you mean by default? When you add a new file, it defaults to putting you in the same directory as the project file (and that you can't change), but you can add files from anywhere to your project.

Share this post


Link to post
Share on other sites
I mean that when you create a project, Visual Studio will automatically create a folder, which it saves your source files to. For example, a project called Demo would have a folder called Demo\Demo in which it would save any source and header files you produce. I need a way to change this folder to be something else, like Demo\OtherDemo. I can't just rename the folder or Visual Studio can't find the source files if I do so.

Share this post


Link to post
Share on other sites
The project file saves the relative path to all the files you've added to it, so if you need to make this change to an existing project, you can open up the file as XML and change the the path. You may need to remove and re-add the project to the solution as well, since that will now be in the "OtherDemo" directory. It should work though.

By default it's creating the "Demo" folder because you named your project "Demo", and there's no way around that to my knowledge. If I want it in a different folder, I just create the project, remove it from the solution, move it to its new location, and then re-add it to the solution. It's not elegant, but I really don't spend too much time creating projects so it doesn't bother me.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this