title: PSAKE powershell & execute task not running
body: <p>Trying to get a PSAKE script to work.  Its seems that tasks are not executing the functions within them?</p>
  
  <p>I have 2 files</p>
  
  <pre><code>-- default.ps1 --
  Import-Module "C:\dev\Phoenix\trunk\Build\BuildScripts\include.ps1"
  Import-Module "C:\Software\PSAKE\JamesKovacs-psake-b0094de\psake.psm1"
  Invoke-psake "C:\dev\Phoenix\trunk\Build\BuildScripts\build.ps1"
  remove-module psake
  
  
  -- build.ps1 --
  $framework = '4.0'
  
  properties {
      $root_dir = 'c:\dev\Phoenix\trunk\'
      $integration_deploy_dir = '\\Server025\Phoenix_IntegrationTests\'
      $build_scripts_dir = '$root_dir\Build\BuildScripts'
      $test_dir =  Join-Path $root_dir '\Tests\Core.UnitTests\bin\Debug'
      $dll = Join-Path $test_dir 'Phoenix.Core.UnitTests.dll'
  } 
  
  
  task default -depends Test
  
  task MsBuild {  exec { msbuild /version }}
  
  task Test -depends Deploy
  {
      Write-Host "Start task Test"
  Add-PSSnapIn Gallio
  Write-Host "TEST --  $dll" 
  Test-Gallio $test_dir Release x64 $dll "Core.UnitTests"     ## FYI - call to include func
  Write-Host "End task Test"
  }
  
  task Deploy
  {
  Write-Host "Start task deploy"
  Write-Host "Deploying to integration server"
  copy $root_dir"\Sites" $integration_deploy_dir -Recurse -Force
  Write-Host "End task deploy"    
  }
  </code></pre>
  
  <p>At the moment it just seems to 'print out' the stuff listed within tasks without actually doing anything.  What am I missing?  Thanks</p>
  
  <p>Sorry forgot to mention I really just want to get the COPY method working first -- thx</p>
  
  <hr>
  
  <p>Thanks for the help - Ive made all your suggestions and still no luck.</p>
  
  <p>If I put the code 'inline' rather that in PSAKE tasks the code runs fine.</p>
  
  <p>I now have this</p>
  
  <pre><code>-- default.ps1
  Import-Module C:\dev\Phoenix\trunk\Build\BuildScripts\include.ps1
  Import-Module C:\Software\PSAKE\JamesKovacs-psake-b0094de\psake.psm1
  Invoke-psake C:\dev\Phoenix\trunk\Build\BuildScripts\build.ps1
  remove-module psake
  </code></pre>
  
  <p>-- build.ps1
      $framework = '4.0'</p>
  
  <pre><code>properties {
  $root_dir = 'c:\dev\Phoenix\trunk'
  $sites_dir = 'c:\dev\Phoenix\trunk\sites'
  $integration_deploy_dir = '\\Vsydnweb025\Phoenix_IntegrationTests\'
  $build_scripts_dir = "$root_dir\Build\BuildScripts"
  }
  
  task default -depends Deploy
  
  task Deploy
  {
  Write-Host 'Start task deploy'
  Write-Host 'Deploying to integration server'
  copy $sites_dir $integration_deploy_dir -Recurse -Force
  Write-Host 'End task deploy'
  get-childitem $integration_deploy_dir -include *.svclog -recurse | foreach ($_)  {remove-item $_.fullname}
  }
  </code></pre>
  
  <p>The output of this is as follows:</p>
  
  <pre><code>Write-Host 'Start task deploy'
  Write-Host 'Deploying to integration server'
  copy $sites_dir $integration_deploy_dir -Recurse -Force
  Write-Host 'End task deploy'
  get-childitem $integration_deploy_dir -include *.svclog -recurse | foreach ($_) {remove-item $_.fullname}
  
  
  Build Succeeded!
  
  ----------------------------------------------------------------------
  Build Time Report
  ----------------------------------------------------------------------
  Name   Duration        
  ----   --------        
  Deploy 00:00:00.0006013
  Total: 00:00:02.5335350
  </code></pre>
  
  <p>So it seems the functions within the task are just being printed out.</p>
  
  <p>The copy function did not run - nor the Piped .SvcLog file delete</p>
  
  <p>Ie on the screen I would expect</p>
  
  <p>'Start task deploy'</p>
  
  <p>instead of </p>
  
  <p>Write-Host 'Start task deploy'</p>
  
  <p>Ill keep trying to get it to work.</p>
  
  <p>Thanks for your help!!!</p>