x First time here? Check out the FAQ

Working in Visual Studio when developing umbraco solutions

    For this Open Space Session I would like to talk about how umbraco developers uses Visual Studio when developing umbraco solutions.

    I demonstrated how we are doing that at my work, and what benefits we get from having as much as possible in a Visual Studio Web Application Project and placed under source control.

     

    Setting up a new umbraco project in Visual Studio

    We start setting up a remote database to be shared between all developers. Then unzipping the latest build of umbraco in a folder on the dev computers and pointing a IIS website to that folder. (Hint: use IIS Admin Pro to run multiple websites on your IIS on XP). Then we run the install wizard on one of the dev computers, which adds the required structure to the database.

    A new Visual Studio Web Application Project is then created on a dev computer in a folder outside the umbraco website folder. In this project, we are going to have all files that are not part of a standard umbraco installation. A folder structure is created in the Web Application Project:

    - bulkCopyToUmbraco
    - css
    - images
    - masterpages
    - scripts
    - usercontrols
    - xslt

    The Web Application Project will never run as a website. The project is only used to hold maintain our files and code. We are creating css files, images, masterpages, javascripts, user controls and xslt files in this project. This for example allows us have code behild files for our masterpages (templates) which opens up for a lot of opportunities.

    The bulkCopyToUmbraco folder contains all other files we would like to copy to or overwrite in the umbraco website folder.

    Building and copying the required files to umbraco

    To copy all the files required to run our umbraco website, we use Post Build Events for the Web Application Project in Visual Studio. The Post Build Event Command Lines could look something like this:

    XCOPY "$(ProjectDir)bin\MyNamespace.*.*" "$(ProjectDir)..\Umbraco\bin" /Y /R
    XCOPY "$(ProjectDir)bulkCopyToUmbraco\*" "$(ProjectDir)..\Umbraco" /Y /S /E /R
    XCOPY "$(ProjectDir)controls\*.ascx" "$(ProjectDir)..\Umbraco\controls" /Y /R
    XCOPY "$(ProjectDir)css\*.css" "$(ProjectDir)..\Umbraco\css" /Y /R
    XCOPY "$(ProjectDir)images\*" "$(ProjectDir)..\Umbraco\images" /Y /S /E /R
    XCOPY "$(ProjectDir)masterpages\*.master" "$(ProjectDir)..\Umbraco\masterpages" /Y /R
    XCOPY "$(ProjectDir)scripts\*.js" "$(ProjectDir)..\Umbraco\scripts" /Y /S /E /R
    XCOPY "$(ProjectDir)usercontrols\*.ascx" "$(ProjectDir)..\Umbraco\usercontrols" /Y /R
    XCOPY "$(ProjectDir)xslt\*.xslt" "$(ProjectDir)..\Umbraco\xslt" /Y /R

    The above lines copies the relevant files from our Web Application Project to the umbraco website folder. For masterpages and user controls only the .master and the .ascx files are being copies - not the code behind files.

    The $(ProjectDir) macro - that's what Visual Studio calls this - makes sure that each developer can have the umbraco website and the Web Application Project in different locations from the other developers. The paths are relative the the Web Application Project when defined using this macro.

    Deployment

    We also have a set of Command Lines which copies the same files to a Deploy folder. When we are deploying our website, we can FTP from the Deploy folder, and be sure only to transfer the required files to the live server.

    Setting up a new Developer

    When a new developer starts on an existing project, all he or she has to do is to unzip the latest umbraco build to a folder, point an ISS website to that folder, and get the latest version of the Web Application Project from whatever source control.

    As soon as the Web Application Project is built the new developer has his umbraco website up and running.

    Feel free to add your comments if you attended the Open Space Session.

    Multiple Websites in Windows XP Pro IIS:

    neilkilbride.blogspot.com/.../...s-xp-pro-iis.html

    **********************