Skip to content

Get SamplerBuiltModuleBase

gaelcolas edited this page Jul 18, 2024 · 1 revision

Get-SamplerBuiltModuleBase

SYNOPSIS

Get the ModuleBase of a module built with Sampler (directory where the module manifest is).

SYNTAX

Get-SamplerBuiltModuleBase [-OutputDirectory] <String> [[-BuiltModuleSubdirectory] <String>]
 [-ModuleName] <String> [-VersionedOutputDirectory] [[-ModuleVersion] <String>]
 [<CommonParameters>]

DESCRIPTION

Based on a project's configuration of OutputDirectory, BuiltModuleSubdirectory, ModuleName and whether the built module is within a VersionedOutputDirectory; this function will resolve the expected ModuleBase of that Module.

EXAMPLES

EXAMPLE 1

Get-SamplerBuiltModuleBase -OutputDirectory C:\src\output -BuiltModuleSubdirectory 'Module' -ModuleName 'stuff' -ModuleVersion 3.1.2-preview001
# C:\src\output\Module\stuff\3.1.2

PARAMETERS

-BuiltModuleSubdirectory

Sub folder where you want to build the Module to (instead of $OutputDirectory/$ModuleName). This is especially useful when you want to build DSC Resources, but you don't want the Get-DscResource command to find several instances of the same DSC Resources because of the overlapping $Env:PSmodulePath ($buildRoot/output for the built module and $buildRoot/output/RequiredModules).

In most cases I would recommend against setting $BuiltModuleSubdirectory.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ModuleName

Name of the Module to retrieve the version from its manifest (See Get-SamplerProjectName).

Type: String
Parameter Sets: (All)
Aliases: ProjectName

Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ModuleVersion

Allows to specify a specific ModuleVersion to search the ModuleBase if known. If the ModuleVersion is not known but the VersionedOutputDirectory is set to $true, a wildcard (*) will be used so that the path can be resolved by Get-Item or similar commands.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: *
Accept pipeline input: False
Accept wildcard characters: False

-OutputDirectory

Output directory (usually as defined by the Project). By default it is set to 'output' in a Sampler project.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-VersionedOutputDirectory

Whether the Module is built with its versioned Subdirectory, as you would see it on a System. For instance, if VersionedOutputDirectory is $true, the built module's ModuleBase would be: output/MyModuleName/2.0.1/

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.String

NOTES

RELATED LINKS

Clone this wiki locally