New-GacAssemblyInstallReference.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<#
.SYNOPSIS
    Creates a new install reference
.DESCRIPTION
    Creates a new install reference to be used with Add-GacAssembly or Remove-GacAssembly
.PARAMETER Type
    Specifies the type of the install reference to be created
.PARAMETER Identifier
    Specifies the identifier of the install reference to be created
.PARAMETER Description
    Specifies the description of the install reference to be created
.INPUTS
 [PowerShellGac.InstallReference[]]
.EXAMPLE
    C:\PS> $reference = New-GacAssemblyInstallReference Opaque ([guid]::NewGuid()) 'Sample install reference'
 
    This example shows how you can create a new install reference.
.LINK
 Add-GacAssembly
.LINK
 Remove-GacAssembly
.LINK
 http://powershellgac.codeplex.com
#>

function New-GacAssemblyInstallReference
{
    [CmdletBinding()]
    [OutputType('PowerShellGac.InstallReference')]
    param
    (
        [Parameter(Position = 0, Mandatory = $true)]
        [ValidateNotNullOrEmpty()]
        [PowerShellGac.InstallReferenceType] $Type,

        [Parameter(Position = 1, Mandatory = $true)]
        [ValidateNotNullOrEmpty()]
        [string] $Identifier,

        [Parameter(Position = 2)]
        [ValidateNotNullOrEmpty()]
        [string] $Description
    )
    
    process
    {
        New-Object -TypeName 'PowerShellGac.InstallReference' -ArgumentList $Type, $Identifier, $Description
    }
}