Rationale - I am actually using Publish-Module
PS function to publish a PS module. This function internally calls either nuget.exe or dotnet.exe nuget
to actually push the PS module package.
Unfortunately, this function does not pass the -ConfigFile
argument effectively forcing us to use the user level $env:APPDATA\NuGet\NuGet.config
file.
Why the file matters? The repo requires Access Token to authenticate. I do not know any other way except record it in the NuGet.config file. If there is one that would spare the config file at all - I will gladly use it.
So I am looking for one of the following:
-ConfigFile
argument. E.g. - through a well-known environment variable.I found the following solution:
[IO.Directory]::SetCurrentDirectory
and Set-Location
. It is important to use both this API and the Powershell native Set-Location