Delete temporary folder created by "dotnet restore".
Also create the temp folder in the OS temp path. Fix - #811
This commit is contained in:
parent
c90a35b80e
commit
737ed67571
1 changed files with 12 additions and 6 deletions
|
@ -110,15 +110,21 @@ namespace Microsoft.DotNet.Tools.Restore
|
||||||
|
|
||||||
private static void RestoreTool(LibraryRange tooldep, RestoreTask restoreTask)
|
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);
|
PersistLockFile(tooldep, tempPath, restoreTask.ProjectDirectory);
|
||||||
|
}
|
||||||
Directory.Delete(tempPath, true);
|
finally
|
||||||
|
{
|
||||||
|
Directory.Delete(tempRoot, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void PersistLockFile(LibraryRange tooldep, string tempPath, string projectPath)
|
private static void PersistLockFile(LibraryRange tooldep, string tempPath, string projectPath)
|
||||||
|
|
Loading…
Reference in a new issue