Skip to content

Commit 68ddbf3

Browse files
gfraiteurclaude
andcommitted
Support multiple dotnet tool manifest locations and update Resharper
- Support both .config/dotnet-tools.json and dotnet-tools.json paths - Add TryFindConfigFile helper to check multiple locations - Update Resharper to 2025.3.2 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent ea02283 commit 68ddbf3

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

src/PostSharp.Engineering.BuildTools/Utilities/DotNetTool.cs

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
using PostSharp.Engineering.BuildTools.Build;
66
using System;
77
using System.Collections.Immutable;
8+
using System.Diagnostics.CodeAnalysis;
89
using System.IO;
10+
using System.Linq;
911
using System.Text.Json;
1012
using System.Threading;
1113

@@ -23,7 +25,7 @@ public class DotNetTool
2325

2426
public static DotNetTool SignClient { get; } = new SignTool();
2527

26-
public static DotNetTool Resharper { get; } = new( "jb", "JetBrains.Resharper.GlobalTools", "2025.3.0-rc01", "jb" );
28+
public static DotNetTool Resharper { get; } = new( "jb", "JetBrains.Resharper.GlobalTools", "2025.3.2", "jb" );
2729

2830
public static ImmutableArray<DotNetTool> DefaultTools { get; } = [SignClient, Resharper];
2931

@@ -40,7 +42,8 @@ public bool Install( BuildContext context )
4042
{
4143
var baseDirectory = context.RepoDirectory;
4244

43-
var configFilePath = Path.Combine( baseDirectory, ".config", "dotnet-tools.json" );
45+
// Different SDKs might have different locations for the dotnet tool manifest.
46+
string[] configFilePaths = [Path.Combine( baseDirectory, ".config", "dotnet-tools.json" ), Path.Combine( baseDirectory, "dotnet-tools.json" )];
4447
var resourceDirectory = Path.Combine( baseDirectory, ".tools" );
4548

4649
// Use a named mutex to prevent race conditions when multiple parallel builds
@@ -67,7 +70,7 @@ public bool Install( BuildContext context )
6770
try
6871
{
6972
// 1. Create the dotnet tool manifest.
70-
if ( !File.Exists( configFilePath ) )
73+
if ( !TryFindConfigFile( out var configFilePath ) )
7174
{
7275
// Use --output to explicitly specify where to create the manifest.
7376
// Without this, dotnet will skip creation if a manifest exists in a parent directory.
@@ -81,10 +84,11 @@ public bool Install( BuildContext context )
8184
}
8285

8386
// Verify the manifest was created where expected.
84-
if ( !File.Exists( configFilePath ) )
87+
if ( !TryFindConfigFile( out configFilePath ) )
8588
{
8689
context.Console.WriteError(
87-
$"The 'dotnet new tool-manifest' command succeeded but the manifest was not created at the expected location: '{configFilePath}'. " +
90+
$"The 'dotnet new tool-manifest' command succeeded but the manifest was not created at the expected locations: '{string.Join( ", ", configFilePaths )}'. "
91+
+
8892
$"Working directory was: '{baseDirectory}'." );
8993

9094
return false;
@@ -166,6 +170,25 @@ public bool Install( BuildContext context )
166170
{
167171
mutex.ReleaseMutex();
168172
}
173+
174+
bool TryFindConfigFile( [NotNullWhen( true )] out string? configFilePath )
175+
{
176+
foreach ( var configFilePathCandidate in configFilePaths )
177+
{
178+
if ( File.Exists( configFilePathCandidate ) )
179+
{
180+
configFilePath = configFilePathCandidate;
181+
182+
context.Console.WriteMessage( $"Found dotnet tool manifest at '{configFilePath}'." );
183+
184+
return true;
185+
}
186+
}
187+
188+
configFilePath = null;
189+
190+
return false;
191+
}
169192
}
170193

171194
public virtual bool Invoke( BuildContext context, string command, ToolInvocationOptions? options = null )

0 commit comments

Comments
 (0)