Tuesday, February 8, 2011

Structure of projects in version control - .NET specific

This post is similar to this previously asked question. I really want to set up my SVN repository in TTB format, but when creating a project in Visual Studio 2008 (ASP.NET/VB.NET), the structure created tends to be incompatible when considering the solution file, project files, folders for projects, multiple projects within solutions, etc. Does anyone have a script or procedure to take a newly created ASP.NET project and move it to a TTB format as painlessly as possible?

  • If your TTB are common rather than per project, there is no problem with it. Or am I missing something?

    From Lev
  • We went with a very simplistic approach:

    File Structure:

    • Solution Folder (contains solution file, build scripts, maybe more?)
      • Project Folder
      • Project Folder 2
      • References (contains shared assemblies for the solution).

    Then we just check the entire solution folder's contents into our repository. We use one repository for each solution. I'm not sure if this is the optimal way to organize the solution, but it works for us.

    Also, we branch at the highest level, not per project.

    VanSkalen : We do exactly the same thing with solution-sized project groups. We also have some smaller single-project items (such as common libraries). it's a TTB per project for these (solution file can be included in the project directory for singles if desired).
    From muloh
  • You can look at this previous post or this project. The project creates a .NET development tree structure (requires .NET 3.5).

    From Fossmo
  • Let me be more specific. Suppose I have a project that I'm creating called StackOverflowIsAwesome. I can put that into my local folder structure (let's say that it's c:\working). When I create it, VS creates c:\working\StackOverflowIsAwesome and a whole bunch of subfolders (bin, app_data, etc.). But I want my repository structure to look like...

    StackOverflowIsAwesome
        /trunk
            /bin
            /app_data
        /tags
        /branches
    

    So, is there a clean way to do this consistently or do I need to resort to constantly moving/modifying files and folders to make this work?

    JKueck : StackOverflowIsAwesome/trunk/src/StackOverflowIsAwesome/bin
    From Dan Coates
  • When dealing with multiple projects that makes up a Visual Studio Solution it is difficult to decide how to structure things properly.

    One critical aspect that you will need to do with your structure is make it easy to retrieve all the files for a particular release. It is important to make this as easy as possible. In subversion copying a root folder over to the tag branches is easier then remembering to repeat the same operation for X projects.

    Being able to work for extended periods outside of the main trunk is also important. You will have to consider that as well.

    You may find that your software has a number of components that naturally group together. You could do something like this

    /tag
    
    /core_library
       /branch
       /main
    
    /business_logic
      /branch
      /main
    
    /report_library
      /branch
      /main
    
    /my_ui
      /branch
      /main
    

    There is no easy answer. What you do really depends on your specific project. If everything is still coming out a snarled mess then perhaps you need to look at how your project is designed and see if that can be changed to improve understanding.

    From RS Conley
  • I do it this way:

    1. Create the project in VS
    2. Import everything in the project folder to repos/projectname/trunk
    3. Add the repos/branches and repos/tags folders

    That gives me a repository structure like:

    projectname
        / trunk
            /bin
            /obj
            /Properties
            projectname.sln
        /tags
        /branches
    

    And I can just leave all of the files in their default places in the file system.

  • Another way:

    StackOverflowIsAwesome
      /trunk
        /database
        /datafiles
        /documents
        /build
        /installer
        /lib 
            /External_DAL (external that points to shared library)
        /utilities
        /vendor
        /src
          /StackOverFlowIsAwesome
            /StackOverFlowIsAwesome.csprj
            /bin
            /...
          /StackOverFlowIsAwesomeTests
            /StackOverFlowIsAwesomeTests.csprj
            /bin
            /...
      /branches
      /tags
    

    This would be for each project. Since we are using a build script, we don't need store our solution file in SVN.

    From JKueck
  • For bigger projects we usually use this format here:

    /Project
        /trunk
           /lib/              # Binary imports here (not in svn)
    
           /src               # Solution file here
              /Libraries      # Library assemblies here
                 /StackOverflowIsAwesome.Common
    
              /Products       # Delivered products here
                 /StackOverflowIsAwesome.Site
    
              /Projects       # internal assemblies here
                 /StackOverflowIsAwesome.Tests
        /branches
            /1.x
        /tags
            /StackOverflowIsAwesome-1.0
    

    Depending on the actual project non source files (documents, etc.) have a directory under the trunk root and extra development resources are under src.

    Independent projects under are under their own /Project root, but in the same repository.

0 comments:

Post a Comment