Skip to content

Commit 604c3fe

Browse files
committed
Remove unnecessary dotnet restore after ref and unref commands
The automatic dotnet restore after adding or removing project references is not needed and adds unnecessary delay and complexity to the ref/unref workflow.
1 parent e68e77f commit 604c3fe

3 files changed

Lines changed: 3 additions & 12 deletions

File tree

src/CommandLine/Commands/Ref.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ public RefCommand(XRepoEnvironment environment)
6565

6666
if (referencedCount > 0)
6767
{
68-
Console.WriteLine($"Referenced {referencedCount} project(s). Running dotnet restore...");
69-
SolutionHelper.DotnetRestore(solutionPath);
68+
Console.WriteLine($"Referenced {referencedCount} project(s).");
7069
}
7170
else
7271
{

src/CommandLine/Commands/Unref.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ public UnrefCommand(XRepoEnvironment environment)
4747
solutionFile.UnreferenceAll();
4848
await solutionFile.SaveAsync();
4949

50-
Console.WriteLine("All xrepo project references have been removed. Running dotnet restore...");
51-
SolutionHelper.DotnetRestore(solutionPath);
50+
Console.WriteLine("All xrepo project references have been removed.");
5251
}
5352
else
5453
{
@@ -68,8 +67,7 @@ public UnrefCommand(XRepoEnvironment environment)
6867

6968
if (result.ModifiedProjectCount > 0)
7069
{
71-
Console.WriteLine($"Removed references to {result.RemovedProjectPathCount} project(s) from {result.ModifiedProjectCount} consuming project(s). Running dotnet restore...");
72-
SolutionHelper.DotnetRestore(solutionPath);
70+
Console.WriteLine($"Removed references to {result.RemovedProjectPathCount} project(s) from {result.ModifiedProjectCount} consuming project(s).");
7371
}
7472
else
7573
{

src/CommandLine/Infrastructure/SolutionHelper.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,5 @@ public static string ResolveSolutionFrom(string? currentDir = null)
2020

2121
return solutions[0];
2222
}
23-
24-
public static void DotnetRestore(string solutionPath)
25-
{
26-
var executor = new ProcessExecutor(Path.GetDirectoryName(solutionPath)!);
27-
executor.Exec("dotnet", "restore").ToList();
28-
}
2923
}
3024
}

0 commit comments

Comments
 (0)