Command/Workspace/UpdateSafeSysOnWorkspace.ps1


Import-Module CmxModule -Force -DisableNameChecking
SetWindowTitle $MyInvocation.MyCommand.Name

Write-Output "Update the SafeSys lib . . . "
$x64 = "$BinariesFolder\Release\x64"
$lib = "$x64\Lib"
$combining = "$lib\Combining"
$safeSys = "$lib\Spec\99BE5FABBC914803AAC385A073A90F20"
$libSln = "$LocalWorkspace\src\SYSLIB\_Solutions\MasterBuild\Library.sln"

if(-not (Test-Path -Path $lib -PathType Container))
{
    Write-Host "No Lib folder found to update. The path $lib does not exist."
    Read-Host "The script has finished. Press any key to exit"
    exit
}
if(Test-Path -PathType Container -Path $combining)
{
    Write-Host "Remove Combining folder . . . "
    Remove-Item -Path $combining -Recurse -Force
}

if(Test-Path -Path $safeSys -PathType Container)
{
    Write-Host "Remove SafeSys folder . . . "
    Remove-Item -Path $safeSys -Recurse -Force
}

if((IsVsDev) -eq $false)
{
    CallVsDev "$VsVersion" *>$null
}

Write-Host "LibSln: $libSln"
if(-not (Test-Path -Path $libSln -PathType Leaf))
{
    Write-Host "The SLN file $libSln does not exists. Cannot update the syslib."
    Read-Host "The script has finished. Press any key to exit"
    exit
}

Write-Host "Build the syslib . . . "
& msbuild "$libSln" /t:Build /p:Configuration=Release`;Platform=x64
Write-Host "Build the syslib has finished. "

Read-Host "The script has finished. Press any key to exit"