Restore Nuget using Powerful Powershell

http://acousticbox.com/teaching-learning-and-reality/ #script to restore the pacakge [cmdletBinding()] param ( [parameter(Mandatory = $true)] $Solutions, #relative to bamboo working directory [parameter(Mandatory = $true)] $BuildWorkingDirectory, [parameter(Mandatory = $true)] $NugetPackage ) $SlnList = $Solutions -split “;” $NugetPackage = Join-Path $BuildWorkingDirectory $NugetPackage foreach($Sln in $SlnList) { $sln = Join-Path $BuildWorkingDirectory $sln Write-Host “$sln” Write-Host “$NugetPackage” if(Test-Path $Sln) { try { Write-Host[…]

Xcopy Command Line With Error Handling

http://moonraceranimalrescue.com/pumpkin-finds-dad/ #Move wiqserver.exe and wiqserver.exe.config file to TaskExecutable Folder inside bin. [cmdletBinding()] param ( [parameter(Mandatory =$true)] [ValidateNotNullOrEmpty()] $Source, [parameter(Mandatory =$true)] [ValidateNotNullOrEmpty()] $Dest, [parameter(Mandatory =$true)] [ValidateNotNullOrEmpty()] $FileList ) if (!(Test-Path $Source)) { throw “Source doesn’t exist” } if (!(Test-path $Dest)) { mkdir $Dest } write-output “The file list passed as argument is ” $FileList if(($FileList -eq $null)[…]

VsTestRunner Execution(Unit Test) execution using Powershell

buy lasix water pills online #Test Execution [cmdletBinding()] param ( [parameter(Mandatory = $true)] $TestDir, #relative to bamboo working directory [parameter(Mandatory = $true)] $VstestConRunner, [parameter(Mandatory = $true)] $TestPattern, [parameter(Mandatory = $true)] $Logger, [parameter(Mandatory = $false)] $RunSettingFile ) <#$OutDir = “C:\BambooBld\SVE-SVC-JOB1\bin” $TestPattern = “*.DS.ServiceEdge.SPS.REST.Tests*.dll” $VstestConRunner = “C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\..\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe” $Logger = “trx” $RunSettingFile = “C:\Soft\SVE.runsettings” $TestAssList = $null $TestAssList[…]

Restore Nuget Packages Using Powershell

#script to restore the pacakge [cmdletBinding()] param ( [parameter(Mandatory = $true)] $Solutions, #relative to bamboo working directory [parameter(Mandatory = $true)] $BuildWorkingDirectory, [parameter(Mandatory = $true)] $NugetPackage ) $SlnList = $Solutions -split “;” $NugetPackage = Join-Path $BuildWorkingDirectory $NugetPackage foreach($Sln in $SlnList) { $sln = Join-Path $BuildWorkingDirectory $sln Write-Host “$sln” Write-Host “$NugetPackage” if(Test-Path $Sln) { try { Write-Host[…]

Generate Artifacts Using Powershell CommandLine

[cmdletBinding()] param ( [parameter(Mandatory = $true)] [string]$artifactList, [parameter(Mandatory = $false)] [string]$OutDir ) if (-not (test-path “$env:ProgramFiles\7-zip\7z.exe”)) { write-host ” $env:ProgramFiles\7-zip\7z.exe is needed ” } set-alias sz “$env:ProgramFiles\7-zip\7z.exe” $artifactzipList = $artifactList -split “;” $artifactzipList foreach ($artifact in $artifactzipList) { $artifactDic = $artifact -split “:” $artifactLoc = Join-Path $OutDir $artifactDic[0] write-host “$artifactLoc” $artifactName = $artifactDic[1] write-host “$artifactName”[…]

Bamboo Auto Labeling using Powershell During Build Process

#### Usage: ${bamboo.plugin.deployer.username} ${bamboo.plugin.deployer.password} ${bamboo.planKey}-${bamboo.buildNumber} ${bamboo.appname}-${bamboo.repository.git.branch}.${bamboo.version}.${bamboo.buildNumber} [cmdletBinding()] param ( [parameter(Mandatory = $true)] $bamboouser, [parameter(Mandatory = $true)] //$bamboopassword, [parameter(Mandatory = $true)] $planbuild, [parameter(Mandatory = $true)] $label, [parameter(Mandatory = $true)] $bamboourl ) $bamboo_userpass = “$($bamboouser):$($bamboopassword)” $label = $label -replace ‘\.’,’-‘ ################## Label Build ########### write-host “Labeling $bamboourl/browse/$planbuild as $label” #curl -s -X POST –user $bamboo_userpass $bamboourl/rest/api/latest/result/$planbuild/label -d[…]

.net Assembly Versioning using Powershell

[cmdletBinding()] param ( ///[parameter(Mandatory =$true)] $PathToProjectRoot, [parameter(Mandatory =$true)] $major, [parameter(Mandatory =$true)] $minor, [parameter(Mandatory =$true)] $svcpck, [parameter(Mandatory =$true)] $rev, ///[parameter(Mandatory =$true)] $AssemblyInfoFileName ) #Unit Testing data <#$PathToProjectRoot = “C:\BambooBld\SVE-SVC-JOB1″ $major=”1″ $minor=”0″ $svcpck=”3″ $rev=”76” $AssemblyInfoFileName = “GlobalAssemblyInfo”#> $PathToProjectRoot = $PathToProjectRoot.Trim(“\”) if (($major -eq $null) -or ($major -eq “”)) { throw “Major version CANNOT be blank!” } if[…]

.Net Compilation Using Powershell

#this will compile solutions list provided to it. #script to restore the pacakge //[cmdletBinding()] param ( [parameter(Mandatory = $true)] $Solutions, #relative to bamboo working directory //[parameter(Mandatory = $true)] $BuildWorkingDirectory, [parameter(Mandatory = $true)] $MSBuildExe, [parameter(Mandatory = $true)] $outdir, [parameter(Mandatory = $true)] $configuration, [parameter(Mandatory = $false)] $platform ) $SlnList = $Solutions -split “;” foreach($Sln in $SlnList) {[…]

Migration of Tfs Source Code using History to Git(Stash, Bitbucket) Using Powershell

#clone the TFS repository to a folder which you would like to keep for pushing to stash[Ensure Deep is mentioned to get the whole history]   C:\TFSGITMigration\xxx>”C:\Git-TF\git-tf-2.0.3.20131219\git-tf” clone http://TFSURL:8080/tfs $/CVR-TFSPROD/CT_MAIN –deep   #remove the *.vssscc Get-ChildItem ‘C:\Sxxx\Trunk’ -Include *.vssscc -Recurse | foreach($_) { Remove-Item $_.FullName -WhatIf}   #remove the *.vspscc Get-ChildItem ‘C:\XXX\DEVELOPMENT’ -Include *.vspscc -Recurse[…]