@react-native-windows/find-dotnet-tools
v0.0.0-canary.2
Published
Helpers to locate .NET-based tools (e.g. pwsh) restored via NuGet or available on PATH.
Keywords
Readme
@react-native-windows/find-dotnet-tools
Helpers to locate .NET-based tools (e.g. PowerShell) restored via dotnet tool restore or
available on PATH.
Used to resolve tool paths consistently across local development and CI environments.
Usage
Add the package as a dependency:
{
"dependencies": {
"@react-native-windows/find-dotnet-tools": "<version>"
}
}findPowerShell
Locates a PowerShell executable by checking, in order:
- A
dotnet-tool-restored copy ofpwsh.exe(skipped in CI builds) pwsh.exeon the system PATH
Throws an error if pwsh.exe cannot be found.
import {findPowerShell} from '@react-native-windows/find-dotnet-tools';
const pwsh = findPowerShell();
// e.g. "C:\\Users\\user\\.nuget\\packages\\PowerShell\\7.6.1\\tools\\net10.0\\any\\win\\pwsh.exe"getNugetGlobalPackagesFolder
Returns the path to the global NuGet packages folder by checking, in order:
- The
NUGET_PACKAGESenvironment variable - The output of
dotnet nuget locals global-packages --list - The default
~/.nuget/packageslocation
import {getNugetGlobalPackagesFolder} from '@react-native-windows/find-dotnet-tools';
const packagesDir = getNugetGlobalPackagesFolder();
// e.g. "C:\\Users\\user\\.nuget\\packages"