Skip to content

Commit 6c83dca

Browse files
committed
Tracing additional information when NuGet restore fails.
1 parent 1ddb3bf commit 6c83dca

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/WebJobs.Script/Description/DotNet/PackageManager.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,21 @@ public Task RestorePackagesAsync()
3939
{
4040
var tcs = new TaskCompletionSource<bool>();
4141

42+
string functionDirectory = null;
43+
string projectPath = null;
44+
string nugetHome = null;
45+
string nugetFilePath = null;
46+
4247
try
4348
{
44-
string functionDirectory = Path.GetDirectoryName(_functionMetadata.ScriptFile);
45-
string projectPath = Path.Combine(functionDirectory, DotNetConstants.ProjectFileName);
46-
string nugetHome = GetNugetPackagesPath();
49+
functionDirectory = Path.GetDirectoryName(_functionMetadata.ScriptFile);
50+
projectPath = Path.Combine(functionDirectory, DotNetConstants.ProjectFileName);
51+
nugetHome = GetNugetPackagesPath();
52+
nugetFilePath = ResolveNuGetPath();
4753

4854
var startInfo = new ProcessStartInfo
4955
{
50-
FileName = ResolveNuGetPath(),
56+
FileName = nugetFilePath,
5157
RedirectStandardOutput = true,
5258
RedirectStandardError = true,
5359
CreateNoWindow = true,
@@ -77,6 +83,12 @@ public Task RestorePackagesAsync()
7783
}
7884
catch (Exception exc)
7985
{
86+
_traceWriter.Error($@"NuGet restore failed with message: '{exc.Message}'
87+
Function directory: {functionDirectory}
88+
Project path: {projectPath}
89+
Packages path: {nugetHome},
90+
Nuget client path: {nugetFilePath}");
91+
8092
tcs.SetException(exc);
8193
}
8294

0 commit comments

Comments
 (0)