我試圖建立在.net 3.5建立與psake我們公司C#項目的腳本,但是當我運行它,它失敗,錯誤成功構建C#.NET 3.5的項目失敗,psake但MSBuild的
default parameter specifiers are not permitted
我谷歌出來,它看起來像是一個問題的.NET 3.5,不允許在函數中的默認參數。
但是很奇怪,使用msbuild.exe構建的相同項目已成功。我試圖設置psake的$ framework變量爲'3.5x86'和'3.5x64',但沒有任何幫助。
你知道psake有什麼問題嗎?或者如果有我失蹤的祕密變量?
我psake腳本:
$scriptDir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
$framework = '3.5x86'
$serverSln = $scriptDir+'\..\Server\Server.sln'
$clientSln = $scriptDir+'\..\Client\Client.sln'
$outDirServer = $scriptDir+'\..\Binaries\Server'
$outDirClient = $scriptDir+'\..\Binaries\Client'
task default -depends Full
task Full -depends Clean, BuildServer, BuildClient #, BuildAccs, DeployRelease
task BuildServer {
#Framework '3.5'
exec { msbuild $serverSln /t:Build /p:Configuration=Release /v:quiet }
}
task BuildClient {
#Framework '3.5'
exec { msbuild $clientSln /t:Build /p:Configuration=Deploy /v:quiet }
exec { msbuild $clientSln /t:Build /p:Configuration=Release /v:quiet }
}
task Clean {
Write-Host Cleaning
if (Test-Path $outDirClient)
{
rd $outDirClient -rec -force | out-null
}
if (Test-Path $outDirServer)
{
rd $outDirServer -rec -force | out-null
}
}
腳本的輸出:
$scriptDir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
$framework = '3.5x86'
$serverSln = $scriptDir+'\..\Server\Server.sln'
$clientSln = $scriptDir+'\..\Client\Client.sln'
$outDirServer = $scriptDir+'\..\Binaries\Server'
$outDirClient = $scriptDir+'\..\Binaries\Client'
task default -depends Full
task Full -depends Clean, BuildServer, BuildClient #, BuildAccs, DeployRelease
task BuildServer {
#Framework '3.5'
exec { msbuild $serverSln /t:Build /p:Configuration=Release /v:quiet }
}
task BuildClient {
#Framework '3.5'
exec { msbuild $clientSln /t:Build /p:Configuration=Deploy /v:quiet }
exec { msbuild $clientSln /t:Build /p:Configuration=Release /v:quiet }
}
task Clean {
Write-Host Cleaning
if (Test-Path $outDirClient)
{
rd $outDirClient -rec -force | out-null
}
if (Test-Path $outDirServer)
{
rd $outDirServer -rec -force | out-null
}
}
看起來在理解構建時存在問題。 VS正在用MSSBuild 4.0構建項目,目標是3.5。我使用msbuild 3.5,這讓我困惑。更多可以在這裏找到:http://stackoverflow.com/questions/4315057/my-project-builds-with-msbuild-4-but-not-with-msbuild-3-5-even-though-im-target# comment4688131_4315192 – kraklin