Skip to content

Commit a354c09

Browse files
committed
Use temp folder as working directory when restoring
1 parent 9120d17 commit a354c09

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

global.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"sdk": {
3+
"version": "3.1.102"
4+
}
5+
}

src/Dotnet.Script.DependencyModel/Context/DotnetRestorer.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Dotnet.Script.DependencyModel.Process;
44
using Dotnet.Script.DependencyModel.ProjectSystem;
55
using System;
6+
using System.IO;
67
using System.Linq;
78

89
namespace Dotnet.Script.DependencyModel.Context
@@ -25,9 +26,12 @@ public void Restore(ProjectFileInfo projectFileInfo, string[] packageSources)
2526
var packageSourcesArgument = CreatePackageSourcesArguments();
2627
var configFileArgument = CreateConfigFileArgument();
2728
var runtimeIdentifier = _scriptEnvironment.RuntimeIdentifier;
29+
var workingDirectory = Path.GetDirectoryName(projectFileInfo.Path);
30+
2831

2932
_logger.Debug($"Restoring {projectFileInfo.Path} using the dotnet cli. RuntimeIdentifier : {runtimeIdentifier} NugetConfigFile: {projectFileInfo.NuGetConfigFile}");
30-
var exitcode = _commandRunner.Execute("dotnet", $"restore \"{projectFileInfo.Path}\" -r {runtimeIdentifier} {packageSourcesArgument} {configFileArgument}");
33+
var exitcode = _commandRunner.Execute("dotnet", $"restore \"{projectFileInfo.Path}\" -r {runtimeIdentifier} {packageSourcesArgument} {configFileArgument}", workingDirectory);
34+
//var exitcode = _commandRunner.Execute("dotnet", $"restore \"{projectFileInfo.Path}\" -r {runtimeIdentifier} {packageSourcesArgument} {configFileArgument}");
3135
if (exitcode != 0)
3236
{
3337
// We must throw here, otherwise we may incorrectly run with the old 'project.assets.json'

src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
3+
<!-- <TargetFrameworks>netcoreapp2.1;netcoreapp3.1</TargetFrameworks> -->
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
45
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
56
</PropertyGroup>
67
<ItemGroup>

src/Dotnet.Script.Tests/ScriptExecutionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ private static string CreateTestScript(string scriptFolder)
470470

471471
private static void CreateTestPackage(string packageLibraryFolder)
472472
{
473-
ProcessHelper.RunAndCaptureOutput("dotnet", "new classlib -n NuGetConfigTestLibrary", packageLibraryFolder);
473+
ProcessHelper.RunAndCaptureOutput("dotnet", "new classlib -n NuGetConfigTestLibrary -f netstandard2.0", packageLibraryFolder);
474474
var projectFolder = Path.Combine(packageLibraryFolder, "NuGetConfigTestLibrary");
475475
ProcessHelper.RunAndCaptureOutput("dotnet", $"pack -o \"{Path.Combine(packageLibraryFolder, "packagePath")}\"", projectFolder);
476476
CreateNuGetConfig(packageLibraryFolder);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy