2

Using Visual Studio 2017 on Windows 10, I have a WPF application with an installer created using the Visual Studio Installer extension. When I install it on another PC, the application starts but then exits within the same second. Nothing in logs.

If I add a manifest to force admin mode, its starts correct. If I copy the files to another folder (outside program files) it starts correct.

Apparently the "program files" is restricted or something? Am I missing something in my setup/installer project? Any other ideas more than welcome!

EDIT: I've tried to create the installer using WIX and then it runs fine. Seems to be some settings in the VS Installer extension.

Werner
  • 1,029
  • 9
  • 19
  • `but then exists within the same second` Could you explain this sentence in detail? – Kyle Wang - MSFT Oct 30 '19 at 05:07
  • @KyleWang dang spelling, it should read "but then it exits within the same second". Fixed. I've also added some more info. – Werner Oct 30 '19 at 10:01
  • You can modify the ACLs on the folder in question to allow writing by regular users (not great) or you could write the settings file somewhere else. There are many ways: [Resolve lacking permissions](https://stackoverflow.com/a/50588465/129130). There is another, [similar answer here](https://stackoverflow.com/a/52407583/129130). Adding a couple further links: [WiX and deployment links, various topics](https://stackoverflow.com/a/25005864/129130). – Stein Åsmul Oct 30 '19 at 11:25
  • Were you able to determine what was causing this? I have an app who's installer is made with WIX but get the same won't run from program files but will run from anywhere else issue. – Reahreic Feb 18 '21 at 17:50

1 Answers1

1

You can modify the ACLs on the folder in question to allow write access by regular users (not great) or you could write the settings file somewhere else where write permission for users is standard.

Adding a couple further links:

Stein Åsmul
  • 34,628
  • 23
  • 78
  • 140
  • It doesn't seem to be write permission that are missing. I might go with WIX instead.which doesn't have the problem. Thanks. – Werner Oct 31 '19 at 13:01
  • 1
    I guess you should try a procmon session. [See ProcMon.exe section here](https://stackoverflow.com/questions/53512998/desktop-applicaton-not-opening-after-installation-in-client-system/53530377#53530377). [Quick sample here](https://stackoverflow.com/a/47792474/129130). Look for anything that does not succeed. I would double check for missing runtimes first. – Stein Åsmul Oct 31 '19 at 14:26