apache / cordova-windows

[DEPRECATED] Apache Cordova Windows
Apache License 2.0
203 stars 171 forks source link

Why can't Cordova Windows be run in an admin prompt? #342

Closed janpio closed 1 year ago

janpio commented 5 years ago

During testing on how to get Paramedic to run on Appveyor CI for Windows, so we can properly test the Windows parts of the plugins in CI, this code blocks running apps:

https://github.com/apache/cordova-windows/blob/b950b256912f5c484ee999c36a2255aa1a8caca8/template/cordova/lib/run.js#L34-L39

It was added back in 2015 by @muratsu with this commit: https://github.com/apache/cordova-windows/commit/b34a5f1194deeeb0bc1699f91ba3678fd2cee445

The JIRA issue was https://issues.apache.org/jira/browse/CB-9097 which mentions that "cordova run will fail for windows if invoked from admin prompt. Currently we will wait until ActivateApplication stage and fail afterwards." but unfortunately does not contain a sample of such an error.

(https://issues.apache.org/jira/browse/CB-10266 is a related JIRA issue, but only has the last bits of an error message - the end result being that ActivateApplication doesn't work, but the cause is missing as well)

I manually tried disabling this check (see https://github.com/apache/cordova-windows/tree/janpio-admin), and surprisingly had no problem building, deploying and running a Cordova Windows app from an admin prompt.

Are you still around @muratsu and maybe remember why this was added? Did Microsoft maybe change things around so it now works? Or am I maybe doing something different that makes this work?


@knight9999 You helped me debug similar problems in the past, could you maybe try my branch https://github.com/apache/cordova-windows/tree/janpio-admin and see if you can add that to a new Cordova project (cordova platform add https://github.com/apache/cordova-windows#janpio-admin) and see if you can build and run the app in an elevated/admin prompt? That would be awesome.

jgchaney commented 5 years ago

Hi. I'm trying to fix this issue in Windows 10, but I cannot seem to find a solution. Could you help me maybe with a step by step of the fix? I'm not much of a programmer and not very familiar with Cordova. I'm setting up a class for Web Programming and just need to get it going.

muratsu commented 5 years ago

Hey @janpio, sorry for the belated reply. I sadly don't remember the exact reason why we disabled running as admin. It has been a while :)

timbru31 commented 1 year ago

We are archiving this repository following Apache Cordova's Deprecation Policy. We will not continue to work on this repository. Therefore all issues and pull requests are being closed. Thanks for your contribution.