From ca2205ac0e990a4d30ce88c2b3b78ae7e70c047e Mon Sep 17 00:00:00 2001 From: "Andrew Coates (REDMOND)" Date: Tue, 14 Apr 2020 12:59:12 -0700 Subject: [PATCH 01/17] Use more of the CLI rather than custom build steps to validate new projects --- .ado/templates/react-native-init.yml | 34 ++++++++++------------------ 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/.ado/templates/react-native-init.yml b/.ado/templates/react-native-init.yml index 500e00e3f74..226e8eac2b8 100644 --- a/.ado/templates/react-native-init.yml +++ b/.ado/templates/react-native-init.yml @@ -87,12 +87,6 @@ steps: Install-Package Microsoft.ReactNative -Source $(System.DefaultWorkingDirectory)/TestMSRNNuget.${{ parameters.platform }}.${{ parameters.configuration }} -Destination $(Agent.BuildDirectory)\testcli\windows\packages condition: eq('true', ${{ parameters.experimentalNugetDependency }}) - - task: NuGetCommand@2 - displayName: NuGet restore testcli - inputs: - command: restore - restoreSolution: $(Agent.BuildDirectory)\testcli\windows\testcli.sln - - template: install-SDK.yml parameters: sdkVersion: $(Win10Version) @@ -114,23 +108,19 @@ steps: -Cleanup:$true condition: and(succeeded(), ${{ parameters.installVsComponents }}) - - task: VSBuild@1 - displayName: VSBuild - testcli + - task: CmdLine@2 + displayName: Build project (Release) + inputs: + script: npx --no-install react-native run-windows --arch ${{ parameters.platform }} --no-launch --no-deploy --release + workingDirectory: $(Agent.BuildDirectory) + condition: eq('Release', ${{ parameters.configuration }}) + + - task: CmdLine@2 + displayName: Build project (Debug) inputs: - solution: $(Agent.BuildDirectory)\testcli\windows\testcli.sln - vsVersion: $(MSBuildVersion) # Optional. Options: latest, 16.0, 15.0, 14.0, 12.0, 4.0 - msbuildArchitecture: $(MSBuildArchitecture) # Optional. Options: x86, x64 - platform: ${{ parameters.platform }} # Optional - configuration: ${{ parameters.configuration }} # Optional - clean: false # Optional - maximumCpuCount: false # Optional - restoreNugetPackages: false # Optional - createLogFile: true - logFileVerbosity: detailed - msbuildArgs: - /p:PreferredToolArchitecture=$(MSBuildPreferredToolArchitecture) - /p:PlatformToolset=$(MSBuildPlatformToolset) - /p:AppxGeneratePrisForPortableLibrariesEnabled=false + script: npx --no-install react-native run-windows --arch ${{ parameters.platform }} --no-launch --no-deploy + workingDirectory: $(Agent.BuildDirectory) + condition: ne('Release', ${{ parameters.configuration }}) - task: PublishBuildArtifacts@1 condition: succeededOrFailed() From 6c1b287e2a920321c7721372dcc3231d72faec2e Mon Sep 17 00:00:00 2001 From: "Andrew Coates (REDMOND)" Date: Tue, 14 Apr 2020 13:04:09 -0700 Subject: [PATCH 02/17] Switch master to only publish nightly --- .ado/publish.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.ado/publish.yml b/.ado/publish.yml index 5df81de516a..249427d156a 100644 --- a/.ado/publish.yml +++ b/.ado/publish.yml @@ -4,11 +4,17 @@ variables: - template: variables/msbuild.yml - template: variables/vs2019.yml +schedules: +- cron: "0 0 * * *" + displayName: Nightly publish build + branches: + include: + - master + trigger: batch: true branches: include: - - master - "*-stable" pr: none From 66fbd82dc5690b9f177bf7986cd2834a450b3f14 Mon Sep 17 00:00:00 2001 From: "Andrew Coates (REDMOND)" Date: Tue, 14 Apr 2020 13:10:10 -0700 Subject: [PATCH 03/17] syntax --- .ado/templates/react-native-init.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.ado/templates/react-native-init.yml b/.ado/templates/react-native-init.yml index 226e8eac2b8..f2724a4e51f 100644 --- a/.ado/templates/react-native-init.yml +++ b/.ado/templates/react-native-init.yml @@ -65,7 +65,7 @@ steps: inputs: artifactName: TestMSRNNuget.${{ parameters.platform }}.${{ parameters.configuration }} downloadPath: $(System.DefaultWorkingDirectory) - condition: eq('true', ${{ parameters.experimentalNugetDependency }}) + condition: and(succeeded(), eq('true', ${{ parameters.experimentalNugetDependency }})) - task: CmdLine@2 displayName: Init new project @@ -85,7 +85,7 @@ steps: targetType: inline script: | Install-Package Microsoft.ReactNative -Source $(System.DefaultWorkingDirectory)/TestMSRNNuget.${{ parameters.platform }}.${{ parameters.configuration }} -Destination $(Agent.BuildDirectory)\testcli\windows\packages - condition: eq('true', ${{ parameters.experimentalNugetDependency }}) + condition: and(succeeded(), eq('true', ${{ parameters.experimentalNugetDependency }})) - template: install-SDK.yml parameters: @@ -113,14 +113,14 @@ steps: inputs: script: npx --no-install react-native run-windows --arch ${{ parameters.platform }} --no-launch --no-deploy --release workingDirectory: $(Agent.BuildDirectory) - condition: eq('Release', ${{ parameters.configuration }}) + condition: and(succeeded(), eq('Release', ${{ parameters.configuration }})) - task: CmdLine@2 displayName: Build project (Debug) inputs: script: npx --no-install react-native run-windows --arch ${{ parameters.platform }} --no-launch --no-deploy workingDirectory: $(Agent.BuildDirectory) - condition: ne('Release', ${{ parameters.configuration }}) + condition: and(succeeded(), eq('Debug', ${{ parameters.configuration }})) - task: PublishBuildArtifacts@1 condition: succeededOrFailed() From fb84b0f37e3397a13985fc848c891e54669094ee Mon Sep 17 00:00:00 2001 From: "Andrew Coates (REDMOND)" Date: Tue, 14 Apr 2020 13:17:19 -0700 Subject: [PATCH 04/17] syntax --- .ado/templates/react-native-init.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ado/templates/react-native-init.yml b/.ado/templates/react-native-init.yml index f2724a4e51f..79c15bd5f54 100644 --- a/.ado/templates/react-native-init.yml +++ b/.ado/templates/react-native-init.yml @@ -113,14 +113,14 @@ steps: inputs: script: npx --no-install react-native run-windows --arch ${{ parameters.platform }} --no-launch --no-deploy --release workingDirectory: $(Agent.BuildDirectory) - condition: and(succeeded(), eq('Release', ${{ parameters.configuration }})) + condition: and(succeeded(), eq('Release', '${{ parameters.configuration }}'')) - task: CmdLine@2 displayName: Build project (Debug) inputs: script: npx --no-install react-native run-windows --arch ${{ parameters.platform }} --no-launch --no-deploy workingDirectory: $(Agent.BuildDirectory) - condition: and(succeeded(), eq('Debug', ${{ parameters.configuration }})) + condition: and(succeeded(), eq('Debug', '${{ parameters.configuration }}'')) - task: PublishBuildArtifacts@1 condition: succeededOrFailed() From 8c87e5f08b73154f90a7e578cdcdc3b9317e8588 Mon Sep 17 00:00:00 2001 From: "Andrew Coates (REDMOND)" Date: Tue, 14 Apr 2020 13:19:22 -0700 Subject: [PATCH 05/17] typo --- .ado/templates/react-native-init.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ado/templates/react-native-init.yml b/.ado/templates/react-native-init.yml index 79c15bd5f54..b9f26827dcf 100644 --- a/.ado/templates/react-native-init.yml +++ b/.ado/templates/react-native-init.yml @@ -113,14 +113,14 @@ steps: inputs: script: npx --no-install react-native run-windows --arch ${{ parameters.platform }} --no-launch --no-deploy --release workingDirectory: $(Agent.BuildDirectory) - condition: and(succeeded(), eq('Release', '${{ parameters.configuration }}'')) + condition: and(succeeded(), eq('Release', '${{ parameters.configuration }}')) - task: CmdLine@2 displayName: Build project (Debug) inputs: script: npx --no-install react-native run-windows --arch ${{ parameters.platform }} --no-launch --no-deploy workingDirectory: $(Agent.BuildDirectory) - condition: and(succeeded(), eq('Debug', '${{ parameters.configuration }}'')) + condition: and(succeeded(), eq('Debug', '${{ parameters.configuration }}')) - task: PublishBuildArtifacts@1 condition: succeededOrFailed() From ed8a5d39f710949dfb3dd97efc9d70806ae3953f Mon Sep 17 00:00:00 2001 From: "Andrew Coates (REDMOND)" Date: Tue, 14 Apr 2020 13:55:07 -0700 Subject: [PATCH 06/17] Test --- .ado/templates/react-native-init.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ado/templates/react-native-init.yml b/.ado/templates/react-native-init.yml index b9f26827dcf..4e84c777a50 100644 --- a/.ado/templates/react-native-init.yml +++ b/.ado/templates/react-native-init.yml @@ -3,7 +3,7 @@ parameters: language: version: platform: - configuration: + configuration: Debug experimentalNugetDependency: false vsComponents: '' listVsComponents: false From cb00f28deba595172d0460467612095f9f64aec9 Mon Sep 17 00:00:00 2001 From: "Andrew Coates (REDMOND)" Date: Tue, 14 Apr 2020 14:11:21 -0700 Subject: [PATCH 07/17] test --- .ado/templates/react-native-init.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.ado/templates/react-native-init.yml b/.ado/templates/react-native-init.yml index 4e84c777a50..8227389923f 100644 --- a/.ado/templates/react-native-init.yml +++ b/.ado/templates/react-native-init.yml @@ -3,7 +3,7 @@ parameters: language: version: platform: - configuration: Debug + configuration: experimentalNugetDependency: false vsComponents: '' listVsComponents: false @@ -108,19 +108,23 @@ steps: -Cleanup:$true condition: and(succeeded(), ${{ parameters.installVsComponents }}) + # Work around issue of parameters not getting expanded in conditions properly + - powershell: | + Write-Host "##vso[task.setvariable variable=localConfig]${{ parameters.configuration}}" + - task: CmdLine@2 displayName: Build project (Release) inputs: script: npx --no-install react-native run-windows --arch ${{ parameters.platform }} --no-launch --no-deploy --release workingDirectory: $(Agent.BuildDirectory) - condition: and(succeeded(), eq('Release', '${{ parameters.configuration }}')) + condition: and(succeeded(), eq('Release', variables['localConfig'])) - task: CmdLine@2 displayName: Build project (Debug) inputs: script: npx --no-install react-native run-windows --arch ${{ parameters.platform }} --no-launch --no-deploy workingDirectory: $(Agent.BuildDirectory) - condition: and(succeeded(), eq('Debug', '${{ parameters.configuration }}')) + condition: and(succeeded(), eq('Debug', variables['localConfig'])) - task: PublishBuildArtifacts@1 condition: succeededOrFailed() From 3f7b82a6ce5dd3fb74b1637daeb9b81899fb2d4f Mon Sep 17 00:00:00 2001 From: "Andrew Coates (REDMOND)" Date: Tue, 14 Apr 2020 14:14:48 -0700 Subject: [PATCH 08/17] syntax --- .ado/templates/react-native-init.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ado/templates/react-native-init.yml b/.ado/templates/react-native-init.yml index 8227389923f..24e9ab5c118 100644 --- a/.ado/templates/react-native-init.yml +++ b/.ado/templates/react-native-init.yml @@ -109,7 +109,7 @@ steps: condition: and(succeeded(), ${{ parameters.installVsComponents }}) # Work around issue of parameters not getting expanded in conditions properly - - powershell: | + - powershell: | Write-Host "##vso[task.setvariable variable=localConfig]${{ parameters.configuration}}" - task: CmdLine@2 From a547ea249f2e15758740fa168eed4eaa1de753b7 Mon Sep 17 00:00:00 2001 From: "Andrew Coates (REDMOND)" Date: Tue, 14 Apr 2020 14:35:27 -0700 Subject: [PATCH 09/17] fix cwd --- .ado/templates/react-native-init.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ado/templates/react-native-init.yml b/.ado/templates/react-native-init.yml index 24e9ab5c118..dfd2a220ef0 100644 --- a/.ado/templates/react-native-init.yml +++ b/.ado/templates/react-native-init.yml @@ -116,14 +116,14 @@ steps: displayName: Build project (Release) inputs: script: npx --no-install react-native run-windows --arch ${{ parameters.platform }} --no-launch --no-deploy --release - workingDirectory: $(Agent.BuildDirectory) + workingDirectory: $(Agent.BuildDirectory)\testcli condition: and(succeeded(), eq('Release', variables['localConfig'])) - task: CmdLine@2 displayName: Build project (Debug) inputs: script: npx --no-install react-native run-windows --arch ${{ parameters.platform }} --no-launch --no-deploy - workingDirectory: $(Agent.BuildDirectory) + workingDirectory: $(Agent.BuildDirectory)\testcli condition: and(succeeded(), eq('Debug', variables['localConfig'])) - task: PublishBuildArtifacts@1 From fb29a17bd1b5f9889bc8dcf8019cae467c7dca04 Mon Sep 17 00:00:00 2001 From: "Andrew Coates (REDMOND)" Date: Tue, 14 Apr 2020 15:18:27 -0700 Subject: [PATCH 10/17] Add msbuild.ProjectImports.zip to default blacklist to avoid metro error on run-windows --- .ado/templates/react-native-init.yml | 10 +--------- .../generator-windows/templates/metro.config.js | 6 ++++++ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.ado/templates/react-native-init.yml b/.ado/templates/react-native-init.yml index dfd2a220ef0..9ad9e1b0531 100644 --- a/.ado/templates/react-native-init.yml +++ b/.ado/templates/react-native-init.yml @@ -126,16 +126,8 @@ steps: workingDirectory: $(Agent.BuildDirectory)\testcli condition: and(succeeded(), eq('Debug', variables['localConfig'])) - - task: PublishBuildArtifacts@1 - condition: succeededOrFailed() - timeoutInMinutes: 10 - inputs: - pathtoPublish: $(Agent.BuildDirectory)/testcli/windows/testcli.sln.log - artifactName: Detailed Logs for testcli.sln ${{ parameters.platform }} ${{ parameters.configuration }} ${{ parameters.experimentalNugetDependency }} - publishLocation: 'Container' - - task: CmdLine@2 displayName: Create bundle testcli inputs: - script: react-native bundle --entry-file index.js platform windows --bundle-output test.bundle + script: npx --no-install react-native bundle --entry-file index.js platform windows --bundle-output test.bundle workingDirectory: $(Agent.BuildDirectory)\testcli diff --git a/vnext/local-cli/generator-windows/templates/metro.config.js b/vnext/local-cli/generator-windows/templates/metro.config.js index 2ed937d5378..a8931a54531 100644 --- a/vnext/local-cli/generator-windows/templates/metro.config.js +++ b/vnext/local-cli/generator-windows/templates/metro.config.js @@ -35,6 +35,12 @@ module.exports = { new RegExp( `${path.resolve(__dirname, 'windows').replace(/[/\\]/g, '/')}.*`, ), + // This prevents "react-native run-windows" from hitting: EBUSY: resource busy or locked, open msbuild.ProjectImports.zip + new RegExp( + `${path + .resolve(__dirname, 'msbuild.ProjectImports.zip') + .replace(/[/\\]/g, '/')}.*`, + ), ]), }, transformer: { From 4147305ac9ddbea353da96fea2d3df085df7fb84 Mon Sep 17 00:00:00 2001 From: "Andrew Coates (REDMOND)" Date: Tue, 14 Apr 2020 15:18:42 -0700 Subject: [PATCH 11/17] Change files --- ...ct-native-windows-2020-04-14-15-18-42-moreclitest.json | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 change/react-native-windows-2020-04-14-15-18-42-moreclitest.json diff --git a/change/react-native-windows-2020-04-14-15-18-42-moreclitest.json b/change/react-native-windows-2020-04-14-15-18-42-moreclitest.json new file mode 100644 index 00000000000..e4654656a61 --- /dev/null +++ b/change/react-native-windows-2020-04-14-15-18-42-moreclitest.json @@ -0,0 +1,8 @@ +{ + "type": "prerelease", + "comment": "Add msbuild.ProjectImports.zip to default blacklist to avoid metro error on run-windows", + "packageName": "react-native-windows", + "email": "acoates@microsoft.com", + "dependentChangeType": "patch", + "date": "2020-04-14T22:18:42.005Z" +} \ No newline at end of file From e642d73d3a8a4b5ed0ba14962c82b9e316367fc9 Mon Sep 17 00:00:00 2001 From: "Andrew Coates (REDMOND)" Date: Tue, 14 Apr 2020 17:06:25 -0700 Subject: [PATCH 12/17] Use a local version of nuget if available --- vnext/local-cli/runWindows/utils/build.js | 35 +++++++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/vnext/local-cli/runWindows/utils/build.js b/vnext/local-cli/runWindows/utils/build.js index 620bd2aaaa5..03cc99d2d72 100644 --- a/vnext/local-cli/runWindows/utils/build.js +++ b/vnext/local-cli/runWindows/utils/build.js @@ -9,6 +9,7 @@ const fs = require('fs'); const os = require('os'); const path = require('path'); +const {execSync} = require('child_process'); const glob = require('glob'); const MSBuildTools = require('./msbuildtools'); const Version = require('./version'); @@ -63,16 +64,34 @@ async function nugetRestore(nugetPath, slnFile, verbose, msbuildVersion) { } async function restoreNuGetPackages(options, slnFile, verbose) { - const nugetPath = + let nugetPath = options.nugetPath || path.join(os.tmpdir(), 'nuget.4.9.2.exe'); - const dlNugetText = 'Downloading NuGet Binary'; - const ensureNugetSpinner = newSpinner(dlNugetText); - const exists = await existsAsync(nugetPath); - if (!exists) { + const ensureNugetSpinner = newSpinner('Locating NuGet executable'); + if (!(await existsAsync(nugetPath))) { + try { + let localNuget = execSync('where nuget') + .toString() + .trim(); + // Ensure the local nuget exe is at least version 4.6 + let localNugetVersion = execSync( + `powershell -Command (Get-Item ${localNuget}).VersionInfo.FileVersion`, + ).toString(); + const localNugetVersionBits = localNugetVersion.split('.'); + if ( + parseInt(localNugetVersionBits[0], 10) > 4 || + (parseInt(localNugetVersionBits[0], 10) === 4 && + parseInt(localNugetVersionBits[1], 10) > 6) + ) { + nugetPath = localNuget; + } + } catch {} + } + + if (!(await existsAsync(nugetPath))) { await commandWithProgress( ensureNugetSpinner, - dlNugetText, + 'Downloading NuGet Binary', 'powershell', `$progressPreference = [System.Management.Automation.ActionPreference]::SilentlyContinue; Invoke-WebRequest https://dist.nuget.org/win-x86-commandline/v4.9.2/nuget.exe -outfile ${nugetPath}`.split( ' ', @@ -82,6 +101,10 @@ async function restoreNuGetPackages(options, slnFile, verbose) { } ensureNugetSpinner.succeed('Found NuGet Binary'); + if (verbose) { + console.log(`Using Nuget: ${nugetPath}`); + } + const msbuildTools = MSBuildTools.findAvailableVersion('x86', verbose); try { await nugetRestore( From 75982438277e1deb884eb3b9180c10d1042b11aa Mon Sep 17 00:00:00 2001 From: "Andrew Coates (REDMOND)" Date: Wed, 15 Apr 2020 09:12:18 -0700 Subject: [PATCH 13/17] review feedback --- .ado/templates/react-native-init.yml | 4 ++-- vnext/local-cli/runWindows/utils/build.js | 14 +------------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/.ado/templates/react-native-init.yml b/.ado/templates/react-native-init.yml index 9ad9e1b0531..c6facedd927 100644 --- a/.ado/templates/react-native-init.yml +++ b/.ado/templates/react-native-init.yml @@ -115,14 +115,14 @@ steps: - task: CmdLine@2 displayName: Build project (Release) inputs: - script: npx --no-install react-native run-windows --arch ${{ parameters.platform }} --no-launch --no-deploy --release + script: npx --no-install react-native run-windows --arch ${{ parameters.platform }} --no-launch --no-deploy --logging --release workingDirectory: $(Agent.BuildDirectory)\testcli condition: and(succeeded(), eq('Release', variables['localConfig'])) - task: CmdLine@2 displayName: Build project (Debug) inputs: - script: npx --no-install react-native run-windows --arch ${{ parameters.platform }} --no-launch --no-deploy + script: npx --no-install react-native run-windows --arch ${{ parameters.platform }} --no-launch --no-deploy --logging workingDirectory: $(Agent.BuildDirectory)\testcli condition: and(succeeded(), eq('Debug', variables['localConfig'])) diff --git a/vnext/local-cli/runWindows/utils/build.js b/vnext/local-cli/runWindows/utils/build.js index 03cc99d2d72..fbec47fe0fd 100644 --- a/vnext/local-cli/runWindows/utils/build.js +++ b/vnext/local-cli/runWindows/utils/build.js @@ -70,21 +70,9 @@ async function restoreNuGetPackages(options, slnFile, verbose) { const ensureNugetSpinner = newSpinner('Locating NuGet executable'); if (!(await existsAsync(nugetPath))) { try { - let localNuget = execSync('where nuget') + nugetPath = execSync('where nuget') .toString() .trim(); - // Ensure the local nuget exe is at least version 4.6 - let localNugetVersion = execSync( - `powershell -Command (Get-Item ${localNuget}).VersionInfo.FileVersion`, - ).toString(); - const localNugetVersionBits = localNugetVersion.split('.'); - if ( - parseInt(localNugetVersionBits[0], 10) > 4 || - (parseInt(localNugetVersionBits[0], 10) === 4 && - parseInt(localNugetVersionBits[1], 10) > 6) - ) { - nugetPath = localNuget; - } } catch {} } From b49f0c6b44361a9ba4cde8b4564353295b2264e6 Mon Sep 17 00:00:00 2001 From: "Andrew Coates (REDMOND)" Date: Wed, 15 Apr 2020 10:10:08 -0700 Subject: [PATCH 14/17] put private nuget package where nuget will find it --- .ado/templates/react-native-init.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ado/templates/react-native-init.yml b/.ado/templates/react-native-init.yml index c6facedd927..a54c2d4abca 100644 --- a/.ado/templates/react-native-init.yml +++ b/.ado/templates/react-native-init.yml @@ -84,7 +84,7 @@ steps: inputs: targetType: inline script: | - Install-Package Microsoft.ReactNative -Source $(System.DefaultWorkingDirectory)/TestMSRNNuget.${{ parameters.platform }}.${{ parameters.configuration }} -Destination $(Agent.BuildDirectory)\testcli\windows\packages + Install-Package Microsoft.ReactNative -Source $(System.DefaultWorkingDirectory)/TestMSRNNuget.${{ parameters.platform }}.${{ parameters.configuration }} -Destination (nuget locals global-packages -list).Split()[1] condition: and(succeeded(), eq('true', ${{ parameters.experimentalNugetDependency }})) - template: install-SDK.yml From 4ffd7546de8af34bb6585b59c7cdddd31a5276f7 Mon Sep 17 00:00:00 2001 From: "Andrew Coates (REDMOND)" Date: Wed, 15 Apr 2020 11:18:33 -0700 Subject: [PATCH 15/17] Another attempt to get cli to pick up private nuget --- .ado/templates/react-native-init.yml | 14 +++++++++++++- vnext/local-cli/generator-windows/index.js | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.ado/templates/react-native-init.yml b/.ado/templates/react-native-init.yml index a54c2d4abca..5a56058acde 100644 --- a/.ado/templates/react-native-init.yml +++ b/.ado/templates/react-native-init.yml @@ -84,7 +84,19 @@ steps: inputs: targetType: inline script: | - Install-Package Microsoft.ReactNative -Source $(System.DefaultWorkingDirectory)/TestMSRNNuget.${{ parameters.platform }}.${{ parameters.configuration }} -Destination (nuget locals global-packages -list).Split()[1] + Install-Package Microsoft.ReactNative -Source $(System.DefaultWorkingDirectory)/TestMSRNNuget.${{ parameters.platform }}.${{ parameters.configuration }} -Destination $(Agent.BuildDirectory)\testcli\localNugets + $xml = [xml](gc $(Agent.BuildDirectory)\testcli\windows\Nuget.Config) + $newSource = $xml.CreateElement("add"); + $keyAttr = $xml.CreateAttribute("key"); + $keyAttr.Value ="PrPublish"; + $valueAttr = $xml.CreateAttribute("value"); + $valueAttr.Value ="$(Agent.BuildDirectory)\testcli\localNugets"; + $newSource.Attributes.Append($keyAttr); + $newSource.Attributes.Append($valueAttr); + $packageSources = $xml.ChildNodes.Item(1).packageSources; + $packageSources.InsertBefore($newSource, $packageSources.FirstChild); + $xml.save($(Agent.BuildDirectory)\testcli\windows\Nuget.Config); + condition: and(succeeded(), eq('true', ${{ parameters.experimentalNugetDependency }})) - template: install-SDK.yml diff --git a/vnext/local-cli/generator-windows/index.js b/vnext/local-cli/generator-windows/index.js index c2b34815ac1..024ab4f6676 100644 --- a/vnext/local-cli/generator-windows/index.js +++ b/vnext/local-cli/generator-windows/index.js @@ -119,7 +119,7 @@ function copyProjectTemplateAndReplace( // Once we are publishing to nuget.org, this shouldn't be needed anymore if (options.experimentalNugetDependency) { [ - { from: path.join(srcPath, projDir, 'NuGet.Config'), to: 'NuGet.Config' }, + { from: path.join(srcPath, projDir, 'NuGet.Config'), to: path.join(windowsDir, 'NuGet.Config.sln') }, ].forEach((mapping) => copyAndReplaceWithChangedCallback(mapping.from, destPath, mapping.to, templateVars, options.overwrite)); } } From 72876afdf7ae82b286d2acf2a39eda5f2c76b879 Mon Sep 17 00:00:00 2001 From: "Andrew Coates (REDMOND)" Date: Wed, 15 Apr 2020 12:00:42 -0700 Subject: [PATCH 16/17] syntax --- .ado/templates/react-native-init.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ado/templates/react-native-init.yml b/.ado/templates/react-native-init.yml index 5a56058acde..b59c3e83582 100644 --- a/.ado/templates/react-native-init.yml +++ b/.ado/templates/react-native-init.yml @@ -95,7 +95,7 @@ steps: $newSource.Attributes.Append($valueAttr); $packageSources = $xml.ChildNodes.Item(1).packageSources; $packageSources.InsertBefore($newSource, $packageSources.FirstChild); - $xml.save($(Agent.BuildDirectory)\testcli\windows\Nuget.Config); + $xml.save("$(Agent.BuildDirectory)\testcli\windows\Nuget.Config"); condition: and(succeeded(), eq('true', ${{ parameters.experimentalNugetDependency }})) From 91cd48c96eb52e964b068d1a93a155c97fdfbfd8 Mon Sep 17 00:00:00 2001 From: "Andrew Coates (REDMOND)" Date: Wed, 15 Apr 2020 15:26:50 -0700 Subject: [PATCH 17/17] typo --- vnext/local-cli/generator-windows/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vnext/local-cli/generator-windows/index.js b/vnext/local-cli/generator-windows/index.js index 024ab4f6676..fc82cf16f7e 100644 --- a/vnext/local-cli/generator-windows/index.js +++ b/vnext/local-cli/generator-windows/index.js @@ -119,7 +119,7 @@ function copyProjectTemplateAndReplace( // Once we are publishing to nuget.org, this shouldn't be needed anymore if (options.experimentalNugetDependency) { [ - { from: path.join(srcPath, projDir, 'NuGet.Config'), to: path.join(windowsDir, 'NuGet.Config.sln') }, + { from: path.join(srcPath, projDir, 'NuGet.Config'), to: path.join(windowsDir, 'NuGet.Config') }, ].forEach((mapping) => copyAndReplaceWithChangedCallback(mapping.from, destPath, mapping.to, templateVars, options.overwrite)); } }