From 6c1f607816162e9beb50f942a0babe9229ac7d68 Mon Sep 17 00:00:00 2001 From: Di Da Date: Wed, 16 Oct 2019 20:30:22 -0700 Subject: [PATCH 1/5] Fix run-windows app installation hang --- .ado/templates/e2e-test-job.yml | 2 +- .../api/react-native-windows.iviewwindowsprops.md | 12 ++++++------ vnext/local-cli/runWindows/runWindows.js | 6 ------ .../runWindows/utils/WindowsStoreAppUtils.ps1 | 10 ++++++++++ vnext/local-cli/runWindows/utils/deploy.js | 13 ++++++++++++- 5 files changed, 29 insertions(+), 14 deletions(-) diff --git a/.ado/templates/e2e-test-job.yml b/.ado/templates/e2e-test-job.yml index 6c0b7e41a47..27ce3dce06c 100644 --- a/.ado/templates/e2e-test-job.yml +++ b/.ado/templates/e2e-test-job.yml @@ -95,7 +95,7 @@ jobs: - task: CmdLine@2 displayName: run-windows inputs: - script: react-native run-windows --no-packager --arch ${{ parameters.BuildPlatform }} --release --bundle --logging --force + script: react-native run-windows --no-packager --arch ${{ parameters.BuildPlatform }} --release --bundle --logging workingDirectory: packages/E2ETest # Wait for app to launch. A workaround to avoid WinAppDriver error: Failed to locate opened application window with appId diff --git a/vnext/docs/api/react-native-windows.iviewwindowsprops.md b/vnext/docs/api/react-native-windows.iviewwindowsprops.md index c0700d60183..5d5fc20b771 100644 --- a/vnext/docs/api/react-native-windows.iviewwindowsprops.md +++ b/vnext/docs/api/react-native-windows.iviewwindowsprops.md @@ -10,6 +10,12 @@ export interface IViewWindowsProps extends IKeyboardProps, ViewProps ``` +## Remarks + +Props type for ViewWindows component + +Extends: [IKeyboardProps](./react-native-windows.ikeyboardprops.md) and [react-native's ViewProps](https://facebook.github.io/react-native/docs/view) + ## Properties | Property | Type | Description | @@ -19,9 +25,3 @@ export interface IViewWindowsProps extends IKeyboardProps, ViewProps | [accessibilitySetSize](./react-native-windows.iviewwindowsprops.accessibilitysetsize.md) | number | Indicates to accessibility services that the UI Component is within a set with the given size.See https://github.com/ReactWindows/discussions-and-proposals/blob/harinik-accessibility/proposals/0000-accessibilityapis-lists.md | | [children](./react-native-windows.iviewwindowsprops.children.md) | any | | -## Remarks - -Props type for ViewWindows component - -Extends: [IKeyboardProps](./react-native-windows.ikeyboardprops.md) and [react-native's ViewProps](https://facebook.github.io/react-native/docs/view) - diff --git a/vnext/local-cli/runWindows/runWindows.js b/vnext/local-cli/runWindows/runWindows.js index b261190ebaa..328b9a8552f 100644 --- a/vnext/local-cli/runWindows/runWindows.js +++ b/vnext/local-cli/runWindows/runWindows.js @@ -93,7 +93,6 @@ runWindows({ * no-launch: Boolean - Do not launch the app after deployment * no-build: Boolean - Do not build the solution * no-deploy: Boolean - Do not deploy the app - * force: Boolean - same as Add-AppDevPackage.ps1 Force flag */ module.exports = { name: 'run-windows', @@ -146,11 +145,6 @@ module.exports = { 'Enable Bundle configuration and it would be ReleaseBundle/DebugBundle other than Release/Debug', default: false, }, - { - command: '--force', - description: 'same as Add-AppDevPackage.ps1 Force flag', - default: false, - }, { command: '--no-launch', description: 'Do not launch the app after deployment', diff --git a/vnext/local-cli/runWindows/utils/WindowsStoreAppUtils.ps1 b/vnext/local-cli/runWindows/utils/WindowsStoreAppUtils.ps1 index fd710e9280a..68a76ce1874 100644 --- a/vnext/local-cli/runWindows/utils/WindowsStoreAppUtils.ps1 +++ b/vnext/local-cli/runWindows/utils/WindowsStoreAppUtils.ps1 @@ -81,6 +81,16 @@ function CheckIfNeedDeveloperLicense return $Result } +function EnableDevmode { + $RegistryKeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" + + if (-not(Test-Path -Path $RegistryKeyPath)) { + New-Item -Path $RegistryKeyPath -ItemType Directory -Force + } + + Set-ItemProperty -Path $RegistryKeyPath -Name AllowDevelopmentWithoutDevLicense -Value 1 +} + # # Checks whether the package certificate must be installed on the machine. # diff --git a/vnext/local-cli/runWindows/utils/deploy.js b/vnext/local-cli/runWindows/utils/deploy.js index c1afbb50e93..0447f655e07 100644 --- a/vnext/local-cli/runWindows/utils/deploy.js +++ b/vnext/local-cli/runWindows/utils/deploy.js @@ -164,9 +164,20 @@ async function deployToDesktop(options, verbose) { verbose, ); + const devmodeText = 'Enable Developer Mode'; + const devmodeEnable = `-ExecutionPolicy RemoteSigned Import-Module "${windowsStoreAppUtils}"; EnableDevmode "${script}"`; + + await commandWithProgress( + newSpinner(devmodeText), + devmodeText, + 'powershell', + devmodeEnable.split(' '), + verbose, + ); + const installingText = 'Installing new version of the app'; const installApp = `-ExecutionPolicy RemoteSigned Import-Module "${windowsStoreAppUtils}"; Install-App "${script}"`; - const installAppCmd = options.force ? installApp + ' -Force' : installApp; + const installAppCmd = installApp + ' -Force'; await commandWithProgress( newSpinner(installingText), From 120f0cfb065d43ae199b278c5020d4f9a9f42ecb Mon Sep 17 00:00:00 2001 From: Di Da Date: Thu, 17 Oct 2019 09:21:39 -0700 Subject: [PATCH 2/5] Change files --- ...native-windows-2019-10-17-09-21-39-AppPackageFix.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 change/react-native-windows-2019-10-17-09-21-39-AppPackageFix.json diff --git a/change/react-native-windows-2019-10-17-09-21-39-AppPackageFix.json b/change/react-native-windows-2019-10-17-09-21-39-AppPackageFix.json new file mode 100644 index 00000000000..f50fa82bd34 --- /dev/null +++ b/change/react-native-windows-2019-10-17-09-21-39-AppPackageFix.json @@ -0,0 +1,9 @@ +{ + "type": "prerelease", + "comment": "Fix run-windows app installation hang", + "packageName": "react-native-windows", + "email": "dida@ntdev.microsoft.com", + "commit": "6c1f607816162e9beb50f942a0babe9229ac7d68", + "date": "2019-10-17T16:21:39.147Z", + "file": "D:\\react-native-windows\\change\\react-native-windows-2019-10-17-09-21-39-AppPackageFix.json" +} \ No newline at end of file From 777b4e3d942face54d40911dc8487718459a737f Mon Sep 17 00:00:00 2001 From: Di Da Date: Thu, 17 Oct 2019 10:00:57 -0700 Subject: [PATCH 3/5] Minor change --- vnext/local-cli/runWindows/utils/deploy.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/vnext/local-cli/runWindows/utils/deploy.js b/vnext/local-cli/runWindows/utils/deploy.js index 0447f655e07..13ffcbf4d7a 100644 --- a/vnext/local-cli/runWindows/utils/deploy.js +++ b/vnext/local-cli/runWindows/utils/deploy.js @@ -164,7 +164,7 @@ async function deployToDesktop(options, verbose) { verbose, ); - const devmodeText = 'Enable Developer Mode'; + const devmodeText = 'Enabling Developer Mode'; const devmodeEnable = `-ExecutionPolicy RemoteSigned Import-Module "${windowsStoreAppUtils}"; EnableDevmode "${script}"`; await commandWithProgress( @@ -176,14 +176,13 @@ async function deployToDesktop(options, verbose) { ); const installingText = 'Installing new version of the app'; - const installApp = `-ExecutionPolicy RemoteSigned Import-Module "${windowsStoreAppUtils}"; Install-App "${script}"`; - const installAppCmd = installApp + ' -Force'; - + const installApp = `-ExecutionPolicy RemoteSigned Import-Module "${windowsStoreAppUtils}"; Install-App "${script}" -Force`; + await commandWithProgress( newSpinner(installingText), installingText, 'powershell', - installAppCmd.split(' '), + installApp.split(' '), verbose, ); From 99280381c4a5b929e3aa0f3cd04ffad03e5dc253 Mon Sep 17 00:00:00 2001 From: Di Da Date: Thu, 17 Oct 2019 14:36:24 -0700 Subject: [PATCH 4/5] perttier --- vnext/local-cli/runWindows/utils/deploy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vnext/local-cli/runWindows/utils/deploy.js b/vnext/local-cli/runWindows/utils/deploy.js index 13ffcbf4d7a..34b31a53aa7 100644 --- a/vnext/local-cli/runWindows/utils/deploy.js +++ b/vnext/local-cli/runWindows/utils/deploy.js @@ -177,7 +177,7 @@ async function deployToDesktop(options, verbose) { const installingText = 'Installing new version of the app'; const installApp = `-ExecutionPolicy RemoteSigned Import-Module "${windowsStoreAppUtils}"; Install-App "${script}" -Force`; - + await commandWithProgress( newSpinner(installingText), installingText, From 3737a11883c91d8f0c5408d7c57b14c5e68351cf Mon Sep 17 00:00:00 2001 From: Di Da Date: Fri, 18 Oct 2019 09:56:53 -0700 Subject: [PATCH 5/5] PR comments --- vnext/local-cli/runWindows/utils/deploy.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vnext/local-cli/runWindows/utils/deploy.js b/vnext/local-cli/runWindows/utils/deploy.js index 34b31a53aa7..639375eb2b2 100644 --- a/vnext/local-cli/runWindows/utils/deploy.js +++ b/vnext/local-cli/runWindows/utils/deploy.js @@ -158,14 +158,14 @@ async function deployToDesktop(options, verbose) { newSpinner(removingText), removingText, 'powershell', - `-ExecutionPolicy RemoteSigned Import-Module "${windowsStoreAppUtils}" ; Uninstall-App ${appName}`.split( + `-NoProfile -ExecutionPolicy RemoteSigned Import-Module "${windowsStoreAppUtils}" ; Uninstall-App ${appName}`.split( ' ', ), verbose, ); const devmodeText = 'Enabling Developer Mode'; - const devmodeEnable = `-ExecutionPolicy RemoteSigned Import-Module "${windowsStoreAppUtils}"; EnableDevmode "${script}"`; + const devmodeEnable = `-NoProfile -ExecutionPolicy RemoteSigned Import-Module "${windowsStoreAppUtils}"; EnableDevmode "${script}"`; await commandWithProgress( newSpinner(devmodeText), @@ -176,7 +176,7 @@ async function deployToDesktop(options, verbose) { ); const installingText = 'Installing new version of the app'; - const installApp = `-ExecutionPolicy RemoteSigned Import-Module "${windowsStoreAppUtils}"; Install-App "${script}" -Force`; + const installApp = `-NoProfile -ExecutionPolicy RemoteSigned Import-Module "${windowsStoreAppUtils}"; Install-App "${script}" -Force`; await commandWithProgress( newSpinner(installingText),