Recommended Folder Structure When Using Multiple Projects

If you are having a problem using Vault, post a message here.

Moderator: SourceGear

Post Reply
cserold
Posts: 3
Joined: Fri Apr 28, 2006 11:30 am

Recommended Folder Structure When Using Multiple Projects

Post by cserold » Fri Apr 28, 2006 1:46 pm

Is there any documentation/best practices for your client side directory structure when working with multiple Visual Studio projects inside a single solution? (ie. should you have one main directory with the solution file and then a subdirectory for each associated project, etc...)

I am trying to use two projects inside a single Visual Studio 2005 solution with Vault. One is a class library project and the other is a web site. Is it a requirement that the root directory for the class library project be a child of the directory for the web site project in the

For example, could my class library exist at C:\Projects\MyClassLibrary\ when my project was actually at C:\WebApps\MyWebSite\ or would it be better to have the site at C:\WebApps\MyWebSite\ and the class library at C:\WebApps\MyWebSite\MyClassLibrary?

I initially added the two projects to Vault on say, Computer A but when I try to open the Vault depository for the first time on another computer, say Computer B (which does not have the same directory structure as Computer A) there are several duplicated directories created and the setup does not complete.

Any help or direction would be greatly appreciated.

dan
Posts: 2448
Joined: Wed Dec 17, 2003 5:03 pm
Location: SourceGear
Contact:

Post by dan » Mon May 01, 2006 8:41 am

The structure of a project is dictated by Visual Studio, which requires all projects to be underneath a common solution root if you are going to use source control integration. You can use any structure you want if you are using the Vault GUI client to manage source control operations.

See this MS KB article for instructions on the structure of VS projects: http://msdn.microsoft.com/library/defau ... lg_ch3.asp

matt_stephens
Posts: 27
Joined: Wed Mar 08, 2006 4:22 am

Post by matt_stephens » Wed May 10, 2006 8:57 am

We've recently gone through the excercise of moving some code that we've inherited from Visual Studio 2005 in VSS to Visual Studio 2005 with Vault and found it quite tough to come up with something that worked the way we wanted.

If you've got web sites or services that reference other class library projects i'd recommend getting hold of this update for Visual Studio 2005:

http://msdn.microsoft.com/asp.net/refer ... fault.aspx

It seems that they've realised that the 'no project required' mode of working with web sites in VS2005 isn't so good for complicated sites that share other assemblies.

The other thing we found was if you create a project and save the solution in the same folder as the project then try adding it to Vault, it will create an extra folder level with the solution above in Vault. If you then use Open From Source Control it tended to mess with the working folder in Vault. This made it difficult to set up references to projects that were relative and would work on all developers machines.

What we ended up doing was creating a structure like:

Code: Select all

 Source
 +-Solutions
 | +-WebSite1
 | +-WebService1
 |
 +-WebSite1
 +-ClassLibrary1
 +-ClassLibrary2
 +-WebService1
 +-ClassLibrary3
With this layout on disk the solution files go in the appropriate folder below Solutions and projects go in the other folders. With the solution open and referencing all the appropriate other class library projects and files you can then add the solution to Vault and it will maintain the relative layout that matches your disk. Alternatively you can add individual projects to Vault and finally add the solution to Vault and it's perfectly happy.

We never add solutions to Vault unless they reference multiple projects, for projects that can stand alone it's ok to open the project file and just let Visual Studio create a solution for you locally which you can keep in the same folder as the project.

If you're using IIS rather than the development webserver i'd recommend setting up your virtual directories before opening the solution from source control. Visual Studio 2005 seems happy to live with where you're virtual directories are set but when we were initially messing around trying to work out how best to set up our projects we found that it tended to want to put your projects in c:\inetpub\wwwroot if it wasn't already pointed at somewhere else - this causes big problems with multiple developers because typically we store our code in My Documents so unless the solution contains valid relative paths to its referenced files they only work for the user that set the solution up and other developers need to check out the solution file to make changes for themselves.

I know this doesn't follow the msdn guidelines that dan posted but it seems to work ok for us at the moment and we had tons of trouble trying to work how that article suggests. The other nice thing that we gain from this is we can have different solutions to build various key bits of our products as well as a big solution that builds everything that we can use on an automated build machine or for creating the final release files and installer. To get a development machine set up from scratch it's really nice to be able to use the Open From Source Control menu item in Visual Studio and select the big solution that builds everything as that makes vault pull across all the projects and make sure the bindings are correct.

Hope this helps,

Matt

Post Reply