Closed JustinGrote closed 3 years ago
We actually prefix all the files with PnP by means of the Prefix variable as set in the psd1 file included. It's not in the source code, but the released version (and the debug builds all have a PnP prefix). This is a deviation of our approach with the older modules for Windows PowerShell (Legacy) where we hard coded the prefix in the source code for the cmdlets. Making the prefix optional you will be allowed to do
Import-Module -Name PnP.PowerShell -Prefix MyPrefix
The cmdlets will then be available with the MyPrefix prefix, alike Connect-MyPrefixOnline
By default the prefix is set to PnP. The PSD1 file is generated in the build scripts that generate the nightly builds but it's also set in the build script that generates the debug builds: https://github.com/pnp/powershell/blob/4f2b2fddca6a6541fbb99a57a5057f9fa4f44729/build/Build-Release.ps1#L104
@erwinvanhunen then you have a bug because it's still exporting the nonprefixed commands as of 0.1.16.
What do you see when you do
Get-Command -Module PnP.PowerShell
And how did you import the module?
I use the module from the PowerShell Gallery on Windows, Linux and Azure Cloud Shell and everywhere I have prefixes.
If you import the module manually:
Import-Module PnP.PowerShell
That should automatically resolve the psd1 file and use that to load the cmdlets.
File this under "gremlins" because after a full reboot I can't reproduce it, sorry for the trouble, I'll re-inquire if I can consistently reproduce it.
Is your feature request related to a problem? Please describe. Having commands like
Get-Site
encourage non-namespaced cmdlets which may conflict or clobber with other modules. PnP doesn't have absolute domain over this space and should follow standard practices for this.Describe the solution you'd like By default only load prefixed commands (e.g. Get-PnPSite) and for compatability allow for a setting (global variable, cmdlet, etc.) that will enable aliases to the non-namespaced cmdlets like
Get-Site
This will allow those who need the compatibility for legacy scripts to enable it, but encourage new scripts to use a more standard powershell convention.