Update the code that installs the PSScriptAnalyzer module to ensure the NuGet Package Provider is installed and correctly loaded for the CurrentUser. This ensures the user running the build does not need to be running as an administrator, nor do they need to already have the NuGet Package Provider installed and up to date.
Motivation and Context
If a user has not previously installed Modules, they may not be able to use the Cake Recipe file as it may fail to install modules.
Testing
Use the Vagrantfile in the Chocolatey/choco repository to stand up a fresh development environment.
Run build.bat without being elevated from the chocolatey/choco repository.
Note that it fails to install the PowerShell Script Analyzer module.
Replace the install-module.ps1 file in the tools/Chocolatey.Cake.Recipe.0.26.3 directory with the one from this PR branch.
Run build.bat without being elevated again.
Note that it completes the build successfully.
Operating Systems Testing
Windows 10
Change Types Made
[x] Bug fix (non-breaking change).
[ ] Feature / Enhancement (non-breaking change).
[ ] Breaking change (fix or feature that could cause existing functionality to change).
Description Of Changes
Update the code that installs the PSScriptAnalyzer module to ensure the NuGet Package Provider is installed and correctly loaded for the CurrentUser. This ensures the user running the build does not need to be running as an administrator, nor do they need to already have the NuGet Package Provider installed and up to date.
Motivation and Context
If a user has not previously installed Modules, they may not be able to use the Cake Recipe file as it may fail to install modules.
Testing
build.bat
without being elevated from the chocolatey/choco repository.install-module.ps1
file in thetools/Chocolatey.Cake.Recipe.0.26.3
directory with the one from this PR branch.build.bat
without being elevated again.Operating Systems Testing
Windows 10
Change Types Made
Change Checklist
Related Issue