Browse Source

Fix pre-commit hook failure when package source mapping is active

The hook installs dotnet-format with --add-source, which NuGet rejects
when packageSourceMapping is configured. The dotnet10-transport feed is
already declared in NuGet.config; adding a dotnet-format mapping entry
there lets the install succeed without --add-source.

Assisted-by: Claude:claude-sonnet-4-6:GitHub Copilot
pull/4007/head
Daniel Grunwald 1 month ago
parent
commit
54939b6c3d
  1. 2
      BuildTools/pre-commit
  2. 1
      NuGet.config

2
BuildTools/pre-commit

@ -28,7 +28,7 @@ esac @@ -28,7 +28,7 @@ esac
DOTNET_PATH="$DOTNET_CACHE_ROOT/ICSharpCode/ILSpy/dotnet-format-$DOTNET_FORMAT_VERSION"
if [ ! -d "$DOTNET_PATH" ]; then
echo "Downloading dotnet-format $DOTNET_FORMAT_VERSION..."
dotnet tool install --tool-path "$DOTNET_PATH" dotnet-format --version "$DOTNET_FORMAT_VERSION" --add-source "$DOTNET_FORMAT_SOURCE"
dotnet tool install --tool-path "$DOTNET_PATH" dotnet-format --version "$DOTNET_FORMAT_VERSION"
fi
DOTNET_FORMAT="$DOTNET_PATH/dotnet-format$EXE_SUFFIX"

1
NuGet.config

@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
</packageSource>
<packageSource key="dotnet10-transport">
<package pattern="ILCompiler.Reflection.ReadyToRun.Experimental" />
<package pattern="dotnet-format" />
</packageSource>
<packageSource key="dotnet-tools">
<package pattern="Microsoft.DiaSymReader.Converter.Xml" />

Loading…
Cancel
Save