试图让 PSAKE 脚本工作。似乎任务没有执行其中的功能?
我有 2 个文件
-- 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"
}
目前,它似乎只是“打印出”任务中列出的内容,而实际上没有做任何事情。我错过了什么?谢谢
抱歉忘了提我真的只想让 COPY 方法先工作——谢谢
感谢您的帮助 - 我已经提出了您的所有建议,但仍然没有运气。
如果我将代码“内联”而不是放在 PSAKE 任务中,则代码运行良好。
我现在有这个
-- 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'
$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}
}
其输出如下:
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
所以似乎任务中的功能刚刚被打印出来。
复制功能未运行 - Piped .SvcLog 文件也未删除
即在我期望的屏幕上
'开始任务部署'
代替
Write-Host '开始任务部署'
我会继续努力让它发挥作用。
谢谢你的帮助!!!