Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ado/templates/e2e-test-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
}
6 changes: 0 additions & 6 deletions vnext/local-cli/runWindows/runWindows.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down
10 changes: 10 additions & 0 deletions vnext/local-cli/runWindows/utils/WindowsStoreAppUtils.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down
18 changes: 14 additions & 4 deletions vnext/local-cli/runWindows/utils/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,21 +158,31 @@ 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 = `-NoProfile -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 installApp = `-NoProfile -ExecutionPolicy RemoteSigned Import-Module "${windowsStoreAppUtils}"; Install-App "${script}" -Force`;

await commandWithProgress(
newSpinner(installingText),
installingText,
'powershell',
installAppCmd.split(' '),
installApp.split(' '),
verbose,
);

Expand Down