Reputation: 1
I am doing an automatic build of C# applications on a web server with IIS 10.0, my code generates a command for PowerShell.SDK.
using(PowerShell pws = PowerShell.Create())
{
var cmd = $"set-location \"{slnDirectory}\"";
cmd += $"&\"{nugetPath}\" restore -packagesDirectory \"{packagesPath}\" -configFile \"{config}\""
pws.Commands.AddScript(cmd);
var result = pws.Invoke();
}
Generates like this:
set-location ...\project\
&\"...\nuget.exe" restore -packagesDirectory "...\outDir\" -configFile "...\NuGet.Config"
Config:
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3">
</packageSources>
<config>
<add key="http_proxy" value="serverX">
<add key="http_proxy.user" value="userX">
<add key="http_proxy.password" value="passX">
</config>
</configuration>
The main problem is that the command with the answer "It is not possible to load the service index for the source...." does not work through IIS, but if it is run directly on the server via PowerShell, then everything works correctly. Everything works in debugging. The problem is only through IIS
Upvotes: 0
Views: 51