diff --git a/.ado/scripts/build.js b/.ado/scripts/build.js index 47df62d2c65..db46551eba9 100644 --- a/.ado/scripts/build.js +++ b/.ado/scripts/build.js @@ -101,7 +101,7 @@ function ensureNuGet(toolsPath) { ensureDir(toolsPath); console.log(`Downloading nuget.exe to: ${localNuGet}`); execSync( - `powershell.exe -NoLogo -NoProfile -Command ` + + `pwsh.exe -NoLogo -NoProfile -Command ` + `"[Net.ServicePointManager]::SecurityProtocol = ` + `[Net.SecurityProtocolType]::Tls12; ` + `Invoke-WebRequest -Uri 'https://dist.nuget.org/win-x86-commandline/latest/nuget.exe' ` + diff --git a/.ado/templates/yarn-install.yml b/.ado/templates/yarn-install.yml index ad9ce780eff..826595f2c75 100644 --- a/.ado/templates/yarn-install.yml +++ b/.ado/templates/yarn-install.yml @@ -4,6 +4,15 @@ parameters: default: . steps: + - task: NuGetToolInstaller@1 + inputs: + versionSpec: ">=5.8.0" + + - task: NuGetAuthenticate@1 + displayName: 'NuGet Authenticate Internal WinAppSDK Feed' + inputs: + nuGetServiceConnections: 'WinAppSDK Experimental NuGet for RNW' + - script: yarn --cwd ${{ parameters.workingDirectory }} install --immutable displayName: yarn install (immutable) retryCountOnTaskFailure: 2 diff --git a/change/@react-native-windows-cli-d0909d53-2984-4eff-bcf6-fe1702c03277.json b/change/@react-native-windows-cli-d0909d53-2984-4eff-bcf6-fe1702c03277.json new file mode 100644 index 00000000000..46065e97e3a --- /dev/null +++ b/change/@react-native-windows-cli-d0909d53-2984-4eff-bcf6-fe1702c03277.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Upgrade to PowerShell 7", + "packageName": "@react-native-windows/cli", + "email": "julio.rocha@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/change/react-native-windows-f8669931-74f3-4c8e-a1d1-ecb19860ee42.json b/change/react-native-windows-f8669931-74f3-4c8e-a1d1-ecb19860ee42.json new file mode 100644 index 00000000000..f1e3abb1df6 --- /dev/null +++ b/change/react-native-windows-f8669931-74f3-4c8e-a1d1-ecb19860ee42.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Upgrade to PowerShell 7", + "packageName": "react-native-windows", + "email": "julio.rocha@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/packages/@react-native-windows/cli/src/utils/commandWithProgress.ts b/packages/@react-native-windows/cli/src/utils/commandWithProgress.ts index 74e8bec3d0c..8c7577e8e48 100644 --- a/packages/@react-native-windows/cli/src/utils/commandWithProgress.ts +++ b/packages/@react-native-windows/cli/src/utils/commandWithProgress.ts @@ -4,7 +4,10 @@ * @format */ -import {spawn, SpawnOptions} from 'child_process'; +import {execSync, spawn, SpawnOptions} from 'child_process'; +import fs from 'fs'; +import os from 'os'; +import path from 'path'; import ora from 'ora'; import spinners from 'cli-spinners'; import chalk from 'chalk'; @@ -47,7 +50,47 @@ export function newSpinner(text: string) { return ora(options).start(); } -export const powershell = `${process.env.SystemRoot}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`; +function getGlobalNuGetPackagesFolder(): string { + if (process.env.NUGET_PACKAGES) { + return process.env.NUGET_PACKAGES; + } + try { + const output = execSync('nuget locals global-packages -list', { + encoding: 'utf8', + }).trim(); + const match = output.match(/global-packages:\s*(.+)/i); + if (match) { + return match[1].trim(); + } + } catch {} + return path.join(os.homedir(), '.nuget', 'packages'); +} + +function findPwsh(): string { + const nugetPackages = getGlobalNuGetPackagesFolder(); + const nugetPwsh = path.join( + nugetPackages, + 'PowerShell.7.6.1', + 'tools', + 'net8.0', + 'any', + 'pwsh.exe', + ); + if (fs.existsSync(nugetPwsh)) { + return nugetPwsh; + } + + try { + const found = execSync('where pwsh.exe', {encoding: 'utf8'}).trim(); + if (found) { + return found.split(/\r?\n/)[0]; + } + } catch {} + + return `${process.env.SystemRoot}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`; +} + +export const powershell = findPwsh(); export async function runPowerShellScriptFunction( taskDescription: string, diff --git a/vnext/Microsoft.ReactNative.Cxx.UnitTests/packages.experimentalwinui3.lock.json b/vnext/Microsoft.ReactNative.Cxx.UnitTests/packages.experimentalwinui3.lock.json deleted file mode 100644 index 37e573dcf94..00000000000 --- a/vnext/Microsoft.ReactNative.Cxx.UnitTests/packages.experimentalwinui3.lock.json +++ /dev/null @@ -1,194 +0,0 @@ -{ - "version": 1, - "dependencies": { - "native,Version=v0.0": { - "Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn": { - "type": "Direct", - "requested": "[1.8.1.7, )", - "resolved": "1.8.1.7", - "contentHash": "FxNwT4YpsGdqforqFSTGc5f/e+qfRJ+1wf5G1w0nEEkT5pr5M95E5+fOuswpPUGXPZIXM+M7BSVGnCRcQZjomA==" - }, - "Microsoft.Windows.CppWinRT": { - "type": "Direct", - "requested": "[2.0.230706.1, )", - "resolved": "2.0.230706.1", - "contentHash": "l0D7oCw/5X+xIKHqZTi62TtV+1qeSz7KVluNFdrJ9hXsst4ghvqQ/Yhura7JqRdZWBXAuDS0G0KwALptdoxweQ==" - }, - "Microsoft.WindowsAppSDK": { - "type": "Direct", - "requested": "[2.0.0-experimental3, )", - "resolved": "2.0.0-experimental3", - "contentHash": "eP4XWWccngqnwyJVTYbdlVDyUyFW7EintimqOyq3ttk/h4dCwvW0FNTjq6qvnzkmWKiSqoXau/d5Dy27wSAKpg==", - "dependencies": { - "Microsoft.WindowsAppSDK.AI": "[2.0.57-experimental]", - "Microsoft.WindowsAppSDK.Base": "[2.0.0-experimental]", - "Microsoft.WindowsAppSDK.DWrite": "[2.0.0-experimental]", - "Microsoft.WindowsAppSDK.Foundation": "[2.0.8-experimental]", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "[2.0.3-experimental]", - "Microsoft.WindowsAppSDK.ML": "[2.0.44-experimental]", - "Microsoft.WindowsAppSDK.Runtime": "[2.0.0-experimental3]", - "Microsoft.WindowsAppSDK.Widgets": "[2.0.2-experimental]", - "Microsoft.WindowsAppSDK.WinUI": "[2.0.3-experimental]" - } - }, - "Microsoft.Web.WebView2": { - "type": "Transitive", - "resolved": "1.0.3405.78", - "contentHash": "ceiIKuPHnzOf5CUv9nGpIBx0CWCCMWcBdv05QuonmUnpPtm6XDyAh6osgvin7MTpVD5O0+NbS5ts/WU9sgXgvA==" - }, - "Microsoft.Windows.SDK.BuildTools": { - "type": "Transitive", - "resolved": "10.0.26100.4654", - "contentHash": "2mgcOlj/t2RfSyyw+pVESfO+Tk1RkfQzto9Vrq42M1lUQIfQEwbi8QLha9GXWIOj+TFzeHIEJckIoF25mgiM8A==" - }, - "Microsoft.Windows.SDK.BuildTools.MSIX": { - "type": "Transitive", - "resolved": "1.7.20250829.1", - "contentHash": "IMdvRmCIZnBS5GkYnv0po1bcx6U1OF39pqA4TphQ9evDzpCRoSE19/PkDvlUNNrBavTsLIEJgd/TAIFner75ow==" - }, - "Microsoft.WindowsAppSDK.AI": { - "type": "Transitive", - "resolved": "2.0.57-experimental", - "contentHash": "iCDkCyYFnryJjSRAVU3dmOyZaT3wO8COv+gCMImbDiRK6Kx047pYkJalrs/mOK2GbS8GVzgGAh4pOGaavzQmpw==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "2.0.0-experimental", - "Microsoft.WindowsAppSDK.Foundation": "2.0.3-experimental" - } - }, - "Microsoft.WindowsAppSDK.Base": { - "type": "Transitive", - "resolved": "2.0.0-experimental", - "contentHash": "xQY42zJd61lTemFhaEl0GQ+YNHIPeeLnF5sM4lhKfOE0fX3aYCPPH5begOcJBhxsorCk90MGLvCq8dy058sBHg==", - "dependencies": { - "Microsoft.Windows.SDK.BuildTools": "10.0.26100.4654", - "Microsoft.Windows.SDK.BuildTools.MSIX": "1.7.20250829.1" - } - }, - "Microsoft.WindowsAppSDK.DWrite": { - "type": "Transitive", - "resolved": "2.0.0-experimental", - "contentHash": "B21j5wUaHab3LbyaOiGXCRlxW+D2Z7hnUZvALenLseEWDPUYyLvClZgXIYJd3s60J3B+CVQOAop9VQiOzRRquw==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "2.0.0-experimental" - } - }, - "Microsoft.WindowsAppSDK.Foundation": { - "type": "Transitive", - "resolved": "2.0.8-experimental", - "contentHash": "8z2LKsnccAJ2RaXmLNZb7JLrSsX6Ud2nlL3Rz6YO4i1iFu9zYEuIdxz6cxsc/+ZSC8bGSQR8O/4k8NIY+qeXYA==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "2.0.0-experimental", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "2.0.3-experimental" - } - }, - "Microsoft.WindowsAppSDK.InteractiveExperiences": { - "type": "Transitive", - "resolved": "2.0.3-experimental", - "contentHash": "Ck3QUVmo/KIKYK9Fo5YzL8eoUbjkRoBkGJdTQbcXVI61CFoxkwypnNckoyWyM6PfzS8KoxasHJbI8YSt+DNgfw==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "2.0.0-experimental" - } - }, - "Microsoft.WindowsAppSDK.ML": { - "type": "Transitive", - "resolved": "2.0.44-experimental", - "contentHash": "cnPfVfMfOhbVobG417zJVbWLA0P5QZHqrMBEDndQNOcgpUEtKJNY2mC+n3+SLr14P1mKPpzPP9vm/O9APsq4bw==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "2.0.0-experimental", - "Microsoft.WindowsAppSDK.Foundation": "2.0.8-experimental" - } - }, - "Microsoft.WindowsAppSDK.Runtime": { - "type": "Transitive", - "resolved": "2.0.0-experimental3", - "contentHash": "ikNSjK07rUFBWdYwkM/2sSQzxieYgRwVDSM7PJxMxIkSGSeAeba8jmDST05oJfDWtXOpNqfn4CTeaZ/6y8yfNw==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "2.0.0-experimental" - } - }, - "Microsoft.WindowsAppSDK.Widgets": { - "type": "Transitive", - "resolved": "2.0.2-experimental", - "contentHash": "+Trk3vVSlWxBWomjpUjwy5aOowkLHr2m7o7pVn58a03O2e46joBM3WdIGon/ns+BMKPow7knCS6ne6OBWGlVZg==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "2.0.0-experimental" - } - }, - "Microsoft.WindowsAppSDK.WinUI": { - "type": "Transitive", - "resolved": "2.0.3-experimental", - "contentHash": "OuvJXiPEOqBRlai79qi8f35JK/MfvsaIBGoIMNOA5pZznigPezR1XHjwrF1lWMDR3WwJV9Q/rnKWcWfXYw24/Q==", - "dependencies": { - "Microsoft.Web.WebView2": "1.0.3405.78", - "Microsoft.WindowsAppSDK.Base": "2.0.0-experimental", - "Microsoft.WindowsAppSDK.Foundation": "2.0.8-experimental", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "2.0.3-experimental" - } - } - }, - "native,Version=v0.0/win": { - "Microsoft.Web.WebView2": { - "type": "Transitive", - "resolved": "1.0.3405.78", - "contentHash": "ceiIKuPHnzOf5CUv9nGpIBx0CWCCMWcBdv05QuonmUnpPtm6XDyAh6osgvin7MTpVD5O0+NbS5ts/WU9sgXgvA==" - }, - "Microsoft.WindowsAppSDK.Foundation": { - "type": "Transitive", - "resolved": "2.0.8-experimental", - "contentHash": "8z2LKsnccAJ2RaXmLNZb7JLrSsX6Ud2nlL3Rz6YO4i1iFu9zYEuIdxz6cxsc/+ZSC8bGSQR8O/4k8NIY+qeXYA==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "2.0.0-experimental", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "2.0.3-experimental" - } - } - }, - "native,Version=v0.0/win-arm64": { - "Microsoft.Web.WebView2": { - "type": "Transitive", - "resolved": "1.0.3405.78", - "contentHash": "ceiIKuPHnzOf5CUv9nGpIBx0CWCCMWcBdv05QuonmUnpPtm6XDyAh6osgvin7MTpVD5O0+NbS5ts/WU9sgXgvA==" - }, - "Microsoft.WindowsAppSDK.Foundation": { - "type": "Transitive", - "resolved": "2.0.8-experimental", - "contentHash": "8z2LKsnccAJ2RaXmLNZb7JLrSsX6Ud2nlL3Rz6YO4i1iFu9zYEuIdxz6cxsc/+ZSC8bGSQR8O/4k8NIY+qeXYA==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "2.0.0-experimental", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "2.0.3-experimental" - } - } - }, - "native,Version=v0.0/win-x64": { - "Microsoft.Web.WebView2": { - "type": "Transitive", - "resolved": "1.0.3405.78", - "contentHash": "ceiIKuPHnzOf5CUv9nGpIBx0CWCCMWcBdv05QuonmUnpPtm6XDyAh6osgvin7MTpVD5O0+NbS5ts/WU9sgXgvA==" - }, - "Microsoft.WindowsAppSDK.Foundation": { - "type": "Transitive", - "resolved": "2.0.8-experimental", - "contentHash": "8z2LKsnccAJ2RaXmLNZb7JLrSsX6Ud2nlL3Rz6YO4i1iFu9zYEuIdxz6cxsc/+ZSC8bGSQR8O/4k8NIY+qeXYA==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "2.0.0-experimental", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "2.0.3-experimental" - } - } - }, - "native,Version=v0.0/win-x86": { - "Microsoft.Web.WebView2": { - "type": "Transitive", - "resolved": "1.0.3405.78", - "contentHash": "ceiIKuPHnzOf5CUv9nGpIBx0CWCCMWcBdv05QuonmUnpPtm6XDyAh6osgvin7MTpVD5O0+NbS5ts/WU9sgXgvA==" - }, - "Microsoft.WindowsAppSDK.Foundation": { - "type": "Transitive", - "resolved": "2.0.8-experimental", - "contentHash": "8z2LKsnccAJ2RaXmLNZb7JLrSsX6Ud2nlL3Rz6YO4i1iFu9zYEuIdxz6cxsc/+ZSC8bGSQR8O/4k8NIY+qeXYA==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "2.0.0-experimental", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "2.0.3-experimental" - } - } - } - } -} \ No newline at end of file diff --git a/vnext/Microsoft.ReactNative.Cxx.UnitTests/packages.lock.json b/vnext/Microsoft.ReactNative.Cxx.UnitTests/packages.lock.json deleted file mode 100644 index 3077a54470f..00000000000 --- a/vnext/Microsoft.ReactNative.Cxx.UnitTests/packages.lock.json +++ /dev/null @@ -1,194 +0,0 @@ -{ - "version": 1, - "dependencies": { - "native,Version=v0.0": { - "Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn": { - "type": "Direct", - "requested": "[1.8.1.7, )", - "resolved": "1.8.1.7", - "contentHash": "FxNwT4YpsGdqforqFSTGc5f/e+qfRJ+1wf5G1w0nEEkT5pr5M95E5+fOuswpPUGXPZIXM+M7BSVGnCRcQZjomA==" - }, - "Microsoft.Windows.CppWinRT": { - "type": "Direct", - "requested": "[2.0.230706.1, )", - "resolved": "2.0.230706.1", - "contentHash": "l0D7oCw/5X+xIKHqZTi62TtV+1qeSz7KVluNFdrJ9hXsst4ghvqQ/Yhura7JqRdZWBXAuDS0G0KwALptdoxweQ==" - }, - "Microsoft.WindowsAppSDK": { - "type": "Direct", - "requested": "[1.8.260209005, )", - "resolved": "1.8.260209005", - "contentHash": "AGHOiZcrDrpaxpHfEFKlI8MVnibfbSixI5DlbU6ozP/9dyWN5FkTFowg+dEOnaFRCnOzTSAjBQ1HuS4lAO+aMQ==", - "dependencies": { - "Microsoft.WindowsAppSDK.AI": "[1.8.47]", - "Microsoft.WindowsAppSDK.Base": "[1.8.251216001]", - "Microsoft.WindowsAppSDK.DWrite": "[1.8.25122902]", - "Microsoft.WindowsAppSDK.Foundation": "[1.8.260203002]", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "[1.8.260125001]", - "Microsoft.WindowsAppSDK.ML": "[1.8.2124]", - "Microsoft.WindowsAppSDK.Runtime": "[1.8.260209005]", - "Microsoft.WindowsAppSDK.Widgets": "[1.8.251231004]", - "Microsoft.WindowsAppSDK.WinUI": "[1.8.260204000]" - } - }, - "Microsoft.Web.WebView2": { - "type": "Transitive", - "resolved": "1.0.3179.45", - "contentHash": "3pokSH5CnN0G6rGhGFo1y87inxYhNxBQ2Vdf0wlvBj99KHxQJormjDACmqRnFeUsmuNFIhWwfAL1ztq7wD5qRA==" - }, - "Microsoft.Windows.SDK.BuildTools": { - "type": "Transitive", - "resolved": "10.0.26100.4654", - "contentHash": "2mgcOlj/t2RfSyyw+pVESfO+Tk1RkfQzto9Vrq42M1lUQIfQEwbi8QLha9GXWIOj+TFzeHIEJckIoF25mgiM8A==" - }, - "Microsoft.Windows.SDK.BuildTools.MSIX": { - "type": "Transitive", - "resolved": "1.7.20250829.1", - "contentHash": "IMdvRmCIZnBS5GkYnv0po1bcx6U1OF39pqA4TphQ9evDzpCRoSE19/PkDvlUNNrBavTsLIEJgd/TAIFner75ow==" - }, - "Microsoft.WindowsAppSDK.AI": { - "type": "Transitive", - "resolved": "1.8.47", - "contentHash": "9il8KT8WR4T826hnm3M/USZTkPtVXFGE0IztmE1l7H9DPYsa3QHEUgGHFHQg88fsMjdr3vhyMvs23AB+1IYF1w==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "1.8.251216001", - "Microsoft.WindowsAppSDK.Foundation": "1.8.260126001" - } - }, - "Microsoft.WindowsAppSDK.Base": { - "type": "Transitive", - "resolved": "1.8.251216001", - "contentHash": "PS1wriuFknz3W2F2P/e6RvOTM35w89Lsj/f0QmUEPrJjKnc+jM0JLX1vfdytI14y1gNRUTm9uclwP0aH/SVU5w==", - "dependencies": { - "Microsoft.Windows.SDK.BuildTools": "10.0.26100.4654", - "Microsoft.Windows.SDK.BuildTools.MSIX": "1.7.20250829.1" - } - }, - "Microsoft.WindowsAppSDK.DWrite": { - "type": "Transitive", - "resolved": "1.8.25122902", - "contentHash": "zFNn07i7Cyz62Y8FnPQAyzeZK7ww3m9t42i9pzy4C04pNbyUDQ4fG7pB6VSh6n4EyFuYtuFQuDzt4mKmXFrkrg==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "1.8.251216001" - } - }, - "Microsoft.WindowsAppSDK.Foundation": { - "type": "Transitive", - "resolved": "1.8.260203002", - "contentHash": "eKQ/prWq98mW7+E+ffot47iZNbDnq/NVN9R9Gi8vmoU/3Ka6zNNivxdICXh6j7g6REFPCV9530/nQYQC0L3fwg==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "1.8.251216001", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "1.8.260125001" - } - }, - "Microsoft.WindowsAppSDK.InteractiveExperiences": { - "type": "Transitive", - "resolved": "1.8.260125001", - "contentHash": "CTGFd1zhIDbnOltZ6piPvpNXFR1OaNyW3vHvhaILzpGziAgj5DPuVnU3PUp1p5iOBd382FLCBVM6nEPyu/LCOA==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "1.8.251216001" - } - }, - "Microsoft.WindowsAppSDK.ML": { - "type": "Transitive", - "resolved": "1.8.2124", - "contentHash": "l7ZptLbvOWHEJgxZtCQhUzDNCakNcqSJyAa7DNXBLKxGIUMDqq9LnWyYRZZFNQwN7hRfDAR8fEAblP1UHYHGgw==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "1.8.251216001", - "Microsoft.WindowsAppSDK.Foundation": "1.8.260126001" - } - }, - "Microsoft.WindowsAppSDK.Runtime": { - "type": "Transitive", - "resolved": "1.8.260209005", - "contentHash": "aZjMu/glUGjzACowzzhj9drn/Ddfp1yA+f7CFXpkiSk6iZ2x32vhKfcqT64RpJ6R+Dj1hl9/79aXFhIavYNj9g==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "1.8.251216001" - } - }, - "Microsoft.WindowsAppSDK.Widgets": { - "type": "Transitive", - "resolved": "1.8.251231004", - "contentHash": "bIWqQYR8DCoB1SoPOMil5AtgtkTn438wJTdpsHgyO/6o7Eh7PMP5BzrR0KbDsFqy+4LhPWQ4vtwko5k93fECcA==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "1.8.251216001" - } - }, - "Microsoft.WindowsAppSDK.WinUI": { - "type": "Transitive", - "resolved": "1.8.260204000", - "contentHash": "DSpA01+iPXwky4O1uZCrdClSi2aRIYTIhmsTeC1EsJmWBFpSirwNAg4EGHejijV6u4ZVkTdyv3px0Y2P3fp72Q==", - "dependencies": { - "Microsoft.Web.WebView2": "1.0.3179.45", - "Microsoft.WindowsAppSDK.Base": "1.8.251216001", - "Microsoft.WindowsAppSDK.Foundation": "1.8.260203002", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "1.8.260125001" - } - } - }, - "native,Version=v0.0/win": { - "Microsoft.Web.WebView2": { - "type": "Transitive", - "resolved": "1.0.3179.45", - "contentHash": "3pokSH5CnN0G6rGhGFo1y87inxYhNxBQ2Vdf0wlvBj99KHxQJormjDACmqRnFeUsmuNFIhWwfAL1ztq7wD5qRA==" - }, - "Microsoft.WindowsAppSDK.Foundation": { - "type": "Transitive", - "resolved": "1.8.260203002", - "contentHash": "eKQ/prWq98mW7+E+ffot47iZNbDnq/NVN9R9Gi8vmoU/3Ka6zNNivxdICXh6j7g6REFPCV9530/nQYQC0L3fwg==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "1.8.251216001", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "1.8.260125001" - } - } - }, - "native,Version=v0.0/win-arm64": { - "Microsoft.Web.WebView2": { - "type": "Transitive", - "resolved": "1.0.3179.45", - "contentHash": "3pokSH5CnN0G6rGhGFo1y87inxYhNxBQ2Vdf0wlvBj99KHxQJormjDACmqRnFeUsmuNFIhWwfAL1ztq7wD5qRA==" - }, - "Microsoft.WindowsAppSDK.Foundation": { - "type": "Transitive", - "resolved": "1.8.260203002", - "contentHash": "eKQ/prWq98mW7+E+ffot47iZNbDnq/NVN9R9Gi8vmoU/3Ka6zNNivxdICXh6j7g6REFPCV9530/nQYQC0L3fwg==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "1.8.251216001", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "1.8.260125001" - } - } - }, - "native,Version=v0.0/win-x64": { - "Microsoft.Web.WebView2": { - "type": "Transitive", - "resolved": "1.0.3179.45", - "contentHash": "3pokSH5CnN0G6rGhGFo1y87inxYhNxBQ2Vdf0wlvBj99KHxQJormjDACmqRnFeUsmuNFIhWwfAL1ztq7wD5qRA==" - }, - "Microsoft.WindowsAppSDK.Foundation": { - "type": "Transitive", - "resolved": "1.8.260203002", - "contentHash": "eKQ/prWq98mW7+E+ffot47iZNbDnq/NVN9R9Gi8vmoU/3Ka6zNNivxdICXh6j7g6REFPCV9530/nQYQC0L3fwg==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "1.8.251216001", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "1.8.260125001" - } - } - }, - "native,Version=v0.0/win-x86": { - "Microsoft.Web.WebView2": { - "type": "Transitive", - "resolved": "1.0.3179.45", - "contentHash": "3pokSH5CnN0G6rGhGFo1y87inxYhNxBQ2Vdf0wlvBj99KHxQJormjDACmqRnFeUsmuNFIhWwfAL1ztq7wD5qRA==" - }, - "Microsoft.WindowsAppSDK.Foundation": { - "type": "Transitive", - "resolved": "1.8.260203002", - "contentHash": "eKQ/prWq98mW7+E+ffot47iZNbDnq/NVN9R9Gi8vmoU/3Ka6zNNivxdICXh6j7g6REFPCV9530/nQYQC0L3fwg==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "1.8.251216001", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "1.8.260125001" - } - } - } - } -} \ No newline at end of file diff --git a/vnext/just-task.js b/vnext/just-task.js index e3fb44c76b1..39ad87cae56 100644 --- a/vnext/just-task.js +++ b/vnext/just-task.js @@ -44,11 +44,34 @@ function codegen(test) { ); } +function getGlobalNuGetPackagesFolder() { + if (process.env.NUGET_PACKAGES) { + return process.env.NUGET_PACKAGES; + } + try { + const output = execSync('nuget locals global-packages -list', { + encoding: 'utf8', + }); + const match = output.match(/global-packages:\s*(.+)/i); + if (match) { + return match[1].trim(); + } + } catch {} + return path.join(require('os').homedir(), '.nuget', 'packages'); +} + function layoutMSRNCxx() { if (require('os').platform() === 'win32') { - const powershell = `${process.env.SystemRoot}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`; + const powershell = path.join( + getGlobalNuGetPackagesFolder(), + 'PowerShell.7.6.1', + 'tools', + 'net8.0', + 'any', + 'pwsh.exe', + ); execSync( - `${powershell} -NoProfile .\\Scripts\\Tfs\\Layout-MSRN-Headers.ps1 -GenerateLocalCxx`, + `"${powershell}" -NoProfile .\\Scripts\\Tfs\\Layout-MSRN-Headers.ps1 -GenerateLocalCxx`, { env: process.env, }, @@ -84,12 +107,23 @@ registerNuGetRestoreTask({ scriptArguments: ['-SkipLockDeletion'], }); +function installNuGetPackagesTask() { + const globalPackages = getGlobalNuGetPackagesFolder(); + execSync( + `nuget install PowerShell -Version 7.6.1 -OutputDirectory "${globalPackages}"`, + {env: process.env}, + ); +} + +task('installNuGetPackages', installNuGetPackagesTask); + task( 'build', series( condition('clean', () => argv().clean), 'copyRNLibraries', 'copyReadmeAndLicenseFromRoot', + 'installNuGetPackages', 'layoutMSRNCxx', 'compileTsPlatformOverrides', 'restoreNuGetPackages',