pslrm (PowerShell Local Resource Manager) is a thin wrapper for Microsoft.PowerShell.PSResourceGet.
pslrm saves PSResourceGet resources into a directory in your project. This gives you project-local (directory-based) dependency management. It also keeps the requirements format compatible with PSResourceGet.
- Installs/updates required resources from PowerShell Gallery into a project-local directory
- Writes a lockfile that records the resolved versions
- Restores the project-local directory to match the lockfile
- Uninstalls resources from the project-local directory
psreq.psd1Requirements file (compatible with PSResourceGet-RequiredResourceFileformat)psreq.lock.psd1Lockfile (versions that PSResourceGet saved)
In psreq.psd1, each entry is a hashtable keyed by module name.
The following keys are commonly used by PSResourceGet.
versionA version string. It can be a range expression like[0.0.1,1.3.0].repositoryThe repository name. pslrm supports PSGallery.prereleaseSet to$trueto allow prerelease versions.
The project root is the directory that contains psreq.psd1.
By default, pslrm saves resources under the project root at ./.pslrm/.
PSResourceGet decides the on-disk layout under ./.pslrm/.
pslrm does not impose a directory structure.
- Supported repository: PowerShell Gallery (PSGallery).
If you set
repositoryinpsreq.psd1, it must resolve to PSGallery. Otherwise, pslrm errors.
Install-PSLResourceInstall project-local resources frompsreq.psd1. Writepsreq.lock.psd1. By default, it outputs direct resources. Use-IncludeDependenciesto output all saved resources.Update-PSLResourceUpdate project-local resources frompsreq.psd1. Rewritepsreq.lock.psd1. By default, it outputs direct resources. Use-IncludeDependenciesto output all saved resources.Get-InstalledPSLResourceReadpsreq.lock.psd1and list installed resources for the project.Uninstall-PSLResourceRemove selected resources from the project by name. It updatespsreq.psd1(and may normalize it) and rewritespsreq.lock.psd1. If it removes all resources, it writes an empty lockfile.Restore-PSLResourceRestore project-local resources to matchpsreq.lock.psd1. Ifpsreq.lock.psd1is missing, it errors. If./.pslrm/exists, it clears the directory before restore.
- pslrm does not include its own dependency solver. PSResourceGet resolves dependencies.
- pslrm does not attempt strict transitive dependency management. It records what PSResourceGet saved into the lockfile.
- NOTE: PSResourceGet models prerelease versions separately from
Version. Example:Version = 6.0.0andPrerelease = alpha5. To preserve prerelease info, pslrm stores versions as normalized strings in the lockfile. Example:6.0.0-alpha5. Ideally, pslrm would use[System.Management.Automation.SemanticVersion]. Windows PowerShell 5.1 does not provide it.