Delete temporary folder created by "dotnet restore".

Also create the temp folder in the OS temp path.

Fix - #811
This commit is contained in:
Sridhar Periyasamy 2016-01-15 13:34:05 -08:00
parent c90a35b80e
commit 737ed67571

View file

@ -110,15 +110,21 @@ namespace Microsoft.DotNet.Tools.Restore
private static void RestoreTool(LibraryRange tooldep, RestoreTask restoreTask)
{
var tempPath = Path.Combine(restoreTask.ProjectDirectory, Guid.NewGuid().ToString(), "bin");
var tempRoot = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
try
{
var tempPath = Path.Combine(tempRoot, "bin");
RestoreToolToPath(tooldep, restoreTask.Arguments, tempPath);
RestoreToolToPath(tooldep, restoreTask.Arguments, tempPath);
CreateDepsInPackageCache(tooldep, tempPath);
CreateDepsInPackageCache(tooldep, tempPath);
PersistLockFile(tooldep, tempPath, restoreTask.ProjectDirectory);
Directory.Delete(tempPath, true);
PersistLockFile(tooldep, tempPath, restoreTask.ProjectDirectory);
}
finally
{
Directory.Delete(tempRoot, true);
}
}
private static void PersistLockFile(LibraryRange tooldep, string tempPath, string projectPath)