user98826
user98826

Reputation: 233

Can we build a website using MSBuild

I am very much new to the Continous Integration. Could anyone please let me know whether we could build a website using MSbuild?

Upvotes: 23

Views: 21301

Answers (4)

Toby Artisan
Toby Artisan

Reputation: 1809

If you have an SLN file for the Web Site, then you can use the following command:

msbuild YourSolutionFile.sln

Upvotes: 5

Jason Jones
Jason Jones

Reputation: 881

You can build a Web Site project using the AspNetCompiler MSBuild task.

http://msdn.microsoft.com/en-us/library/ms164291.aspx

Your MSBuild file might look something like this:

<Project
        xmlns = "http://schemas.microsoft.com/developer/msbuild/2003"
        DefaultTargets = "PrecompileWeb">
        <Target Name = "PrecompileWeb">
                <AspNetCompiler
                        VirtualPath = "DeployTemp" 
                        PhysicalPath = "C:\ccnet\myProject\WebSite"
                        TargetPath = "C:\ccnet\myProject\PreCompiled"
                        Force = "true"
                        Debug = "true"
                        Updateable = "true"/>
        </Target>
</Project>

And then within your ccnet.config, you would add something like the following in the tasks block for your project:

<msbuild>
    <executable>C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe</executable>
        <workingDirectory>C:\ccnet\myProject\</workingDirectory>
        <projectFile>C:\ccnet\myProject\myproject.msbuild</projectFile>
        <logger>C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
</msbuild>

Upvotes: 38

marc_s
marc_s

Reputation: 754973

Yes, you can - even with a "website".

What you need to do is add the "Web Deployment Project" and set it up so it will grab all the files from the website, compile them, and using something like WiX, you can create an installer for the files to be able to easily deploy your web site and all its files needed to a customer's computer.

Marc

Upvotes: 3

Vikram
Vikram

Reputation: 6877

unfortunately, if you have chosen "Website" as the project type you cant. However, if you chose "Web Application" project type, you can use MSBUILD to build it. Once you have created the "web application" project, you can right click on it and select "Add Web Deployment Project" which will add a wdproj file to your solution and you can customize the settings in there.

You can provide this wdproj file to your ccnet config file for the project which can run this as per the schedule configured. i can probably give you teh appropriate nodes required to configure in cc.net config file by tomorrow once i am in the office

Upvotes: -2

Related Questions