2

I'm trying to embed an application icon in an F# windows application, using the method described in the accepted answer to Changing F# application icon.

When I add the .res file to the application (either by setting Build/Other flags to --win32res:MyResourceFile.res or by setting Application/Resource File), the UAC prompt pops up when I start it.

I've tried:

  • Embedding an empty .res file (compiling an empty .rc to .res) - same result.
  • Creating a new console project, changing the output type to Windows and embedding the .res file - same result.
  • Deleting the .suo files just in case - same result.

What could make the addition of a .res file to an app cause UAC to kick in?

(Using VS2015 w latest updates, F# 4.0, .NET 4.6.1)


Edit:

I have created 2 minimal projects the same way, but one of them has the UAC problem and the other doesn't. I've compared the fsproj and sln files, but comparing them (Notepad++ compare plugin) I see no difference in any project setting.

Project files for ConsoleApp1, which does not have the UAC problem: http://s000.tinyupload.com/index.php?file_id=35796827731424697941

Project files for FixVS2015Update, which does have the problem: http://s000.tinyupload.com/index.php?file_id=30669246856403684470

Screenshot of KDiff3, comparing the .fsproj files:
Only file names and GUIDs are different, unless I've missed something.

Comparing the .sln files:
I can't find any differences there either.

Community
  • 1
  • 1
John Reynolds
  • 4,927
  • 4
  • 34
  • 42
  • The resource gets embedded in the .exe file by `--win32res:MyResourceFile.res` and is shown correctly by Explorer, although with the UAC "shield" overlayed. It's not accessed by the app during runtime, so the problem doesn't seem to be related to file access. – John Reynolds Feb 03 '16 at 17:19
  • Here's what I did to fix FixVS2015Update. In VS I unloaded the project, edited the fsproj while still in VS, changed the name of the two XML files, saved fsproj file, reloaded project, rebuilt solution, and the exe in debug ran without a UAC prompt. Still can't reproduce the problem and fix it again. Only fixed it once, now I can't reproduce the problem after making a copy of the project that can reproduce the UAT prompt. Odd. – Guy Coder Feb 03 '16 at 20:14
  • Just fired up dotPeek, and it shows the exact same IL code for both executables. – John Reynolds Feb 03 '16 at 20:17
  • I tried your procedure with both longer and shorter names for the doc XML files, but no difference. I might resort to looking at hex dumps soon... – John Reynolds Feb 03 '16 at 20:30
  • 1
    This comment is way late, but I'm guessing you were running afoul of Windows Installer Detection because your assembly name contained the keyword "Update". See https://stackoverflow.com/questions/28239808/windows-installer-detection-whats-the-full-list-of-keywords – ShawnMartin Oct 04 '17 at 19:02

0 Answers0