Functions/Solutions/Set-CdsSolutionVersion.ps1
<#
.SYNOPSIS Set solution version. #> function Set-CdsSolutionVersion { [CmdletBinding()] param ( [Parameter(Mandatory=$false, ValueFromPipeline)] [Microsoft.Xrm.Tooling.Connector.CrmServiceClient] $XrmClient = $Global:XrmClient, # TODO : Add argument completer with unmanaged solution unique names [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $SolutionUniqueName, [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $Version ) begin { $StopWatch = [System.Diagnostics.Stopwatch]::StartNew(); Trace-CdsFunction -Name $MyInvocation.MyCommand.Name -Stage Start -Parameters ($MyInvocation.MyCommand.Parameters); } process { $solution = $XrmClient | Get-CdsRecord -LogicalName "solution" -AttributeName "uniquename" -Value $SolutionUniqueName -Columns "version"; if(-not $solution) { Write-HostAndLog -Message "Solution $SolutionUniqueName not found" -Level WARN; return $null; } $solution | Set-CdsAttributeValue -Name version -Value $Version | Update-CdsRecord -XrmClient $XrmClient; } end { $StopWatch.Stop(); Trace-CdsFunction -Name $MyInvocation.MyCommand.Name -Stage Stop -StopWatch $StopWatch; } } Export-ModuleMember -Function Set-CdsSolutionVersion -Alias *; |