A simple script that cleans and builds visual studio solution with psake

psake is a simple build automation tool written in powershell, and works well on Microsoft platform.

This is a really simple example that cleans bin folder, run msbuild to build the solution, and clean up pdb and xml files afterward.

properties {
    $BuildConfiguration = if ($BuildConfiguration -eq $null ) { "debug" } else {     
        $BuildConfiguration }
    $BuildScriptsPath = Resolve-Path .
    $base_dir = Resolve-Path ..
    $packages = "$base_dir\packages"
    $build_dir = "$base_dir\Sushiwa\bin"
    $sln_file = "$base_dir\Sushiwa.sln"

task default -depends CleanUp, Compile

task CleanUp {
    @($build_dir) | aWhere-Object { Test-Path $_ } | ForEach-Object {
    Write-Host "Cleaning folder $_..."
    Remove-Item $_ -Recurse -Force -ErrorAction Stop

task Compile {
    Write-Host "Compiling $sln_file in $BuildConfiguration mode to $build_dir"
    Exec { msbuild "$sln_file" /t:Clean /t:Build /p:Configuration=$BuildConfiguration 
        /m /nr:false /v:q /nologo /p:OutputDir=$build_dir }

    Get-ChildItem -Path $build_dir -Rec | Where {$_.Extension -match "pdb"} | Remove-Item
    Get-ChildItem -Path $build_dir -Rec | Where {$_.Extension -match "xml"} | Remove-Item

18 thoughts on “A simple script that cleans and builds visual studio solution with psake

  1. With blogs and forums, realtors can take
    their real estate internet marketing approach
    to a whole new level. Taking an real estate investing course will introduce lots of helpful information needed in today’s market.
    This can be the type of real-estate that needs a high investment to get into the game, much higher than most residential
    property and poses equally great risks dependant upon what you
    plan to do with your commercial real estate property investment.
    Once she was in a more sober frame of mind (though not so
    sober she didn’t try to playfully snatch the lead
    rope from me a few moments later), Nick told me I could bridle her and
    get on. prices appreciating at a healthy rate in Faridabad, buying space in a well located office cum retail hub, purely for investment purpose is not a bad idea.

    Fights often broke out; thievery and prostitution were common in the lowest level.

    Real property is a really good alternative to earn money, yet you have a good understanding of standard notions.
    Be a part of a team of property investors in your area.
    If the Seller or their agent refuses to provide the information requested,
    then the potential Buyer should be prepared to just
    walk away from the deal. It’s hard to beat a job
    for short term money, but in a job you are exchanging your time for
    money and you only have so much time.

  2. Greetings from Colorado! I’m bored at work
    so I decided to check out your website on my iphone during lunch break.
    I enjoy the info you provide here and can’t wait
    to take a look when I get home. I’m amazed at how quick your blog loaded on my cell
    phone .. I’m not even using WIFI, just 3G .. Anyways, great site!

  3. I will immediately snatch your rss feed as I can’t in finding your email
    subscription link or newsletter service. Do you’ve
    any? Kindly allow me understand in order that I could subscribe.

  4. Pay-per-click search engine techniques to unleash a
    tidal wave of traffic to your site. CFE Books in Waheed Book House also offers Recording Financial Transaction, Maintaining Financial Record,
    Financial Reporting, Business Analysis, and Professional
    Accountant. Choose from three different spine sizes and three different
    colors; also choose from either letter or legal size capacities.

  5. I believe everything said was actually very logical. But, what about this?

    what if you added a little information? I mean, I don’t want to tell you how to run your blog, however suppose you added
    something to possibly get a person’s attention?
    I mean A simple script that cleans and builds visual studio solution with psake Andrew Chaa,
    cha cha is a little plain. You ought to look at Yahoo’s front page and
    watch how they create article headlines to grab viewers to open the links.
    You might try adding a video or a picture or two to grab people
    excited about everything’ve written. In my opinion,
    it could make your posts a little bit more interesting.

  6. Ciekawie postujesz. Widać że masz wiedzę w opisywanym
    temacie. Niezwykle ładnie pozostanie jeśli
    przedstawisz więcej takich przypadków, a może zainteresujesz się sprawami
    jak tematyka ludzi o goraniczeniach ruchowych.

  7. Allungare il pene – Grande cazzo Usando il XtraSize mio pene è cresciuto significativamente, le mie erezioni sono diventate più lunghe e più forti, le mie eiaculazioni sono più abbondanti ed
    i miei orgasmi sono molto più forti, ma non è tutto.

  8. Excellent blog here! Also your web site so much up
    fast! What web host are you the usage of? Can I am getting your associate link on your host?

    I desire my site loaded up as fast as yours lol

  9. Hi there I am not sure if it’s me or maybe your blog site but it is starting slow ,
    I had to spend like a few minutes in order to load up still google works well for me.
    On the other hand thanks for posting excellent article.
    I guess it really has already been useful to many people .
    This is definitely incredibly good what you actually have implemented on this
    page and would like to discover content from you.
    To obtain more information by content that you write-up, I have book-marked this url.

  10. After looking into a handful of the blog posts on your website, I truly
    like your way of writing a blog. I saved as a favorite it to
    my bookmark website list and will be checking back soon. Please check
    out my website as well and let me know what you think.

  11. You really make it appear so easy along with your presentation however I in finding this matter to
    be really something which I believe I would never understand.

    It kind of feels too complicated and very huge for me.
    I’m looking ahead on your subsequent submit, I will try to get
    the hang of it!

  12. It is in the human nature to investigate something that is causing some kind of fuss, we
    just cannot help ourselves. Many times word of mouth is the easiest way to find a great free
    comedy video. This is due to the vast audience the internet houses.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s