RefrEnv
RefrEnv copied to clipboard
How does this comapare to chocolatey's new C# rewrite of Update-SessionEnvironment.ps1?
I just found that choco team rewrote the Update-SessionEnvironment.ps1 into C#. This abstracts away any previous issues.
Do you think it is still suffering from the same issues as before?
From: https://github.com/chocolatey/choco/commit/dc409a3de0c03a29d95fec73a555a5d4fedc4ac3
(#310) Add Uninstall-ChocolateyPath as cmdlet
Finally added Uninstall-ChocolateyPath. However, given overall contribution rates to the powershell functions are quite low, the decision has been made to rewrite our helper functions into C# cmdlets.
This serves as the initial set of cmdlets, a handful of useful example cases to prove out the viability of this approach, as well as ensuring that we have a better path forward for both OSS commands and any licensed commands we want to use in the future. It also opens up the possibility of more easily overriding the OSS cmdlets with a licensed command, and there are provisions in the `chocolateyInstaller.psm1` module script to ensure that can work seamlessly.
Summary of changes:
- Added Uninstall-ChocolateyPath helper cmdlet
- Rewrote the following associated functions into C# cmdlets:
- Get-EnvironmentVariable
- Get-EnvironmentVariableNames
- Install-ChocolateyPath
- Set-EnvironmentVariable
- Test-ProcessAdminRights
- Update-SessionEnvironment
- Tweaked the PowerShell command lookup behaviour when loading the `chocolateyInstaller.psm1` module to ensure that licensed cmdlets can be preferentially used instead of open-source cmdlets or functions, regardless of any name collisions that may occur.
- Tweaked the assembly resolver to ensure that if we have the licensed extension depend on the new Chocolatey.PowerShell assembly, it will not cause any issues when trying to load the licensed extension outside the PowerShell module context.