diff --git a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs index 90193a2f57e..cae76f9cbf8 100644 --- a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs +++ b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs @@ -312,7 +312,19 @@ type FSharpDependencyManager(outputDirectory: string option, useResultsCache: bo // if a path was supplied if it was rooted then use the rooted path as the root // if the path wasn't supplied or not rooted use the temp directory as the root. let specialDir = - Path.Combine(Environment.GetFolderPath(System.Environment.SpecialFolder.UserProfile), ".packagemanagement", "nuget") + let getProfilePath = + // If it has a directory seperator remove it + let path = Environment.GetFolderPath(System.Environment.SpecialFolder.UserProfile) + + if + (path.EndsWith(Path.DirectorySeparatorChar.ToString())) + || (path.EndsWith(Path.AltDirectorySeparatorChar.ToString())) + then + path.Substring(0, path.Length - 1) + else + path + // Build path to cache root + $"{getProfilePath}/.packagemanagement/nuget" let path = Path.Combine(Process.GetCurrentProcess().Id.ToString() + "--" + Guid.NewGuid().ToString())