Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force my F# application to run as administrator?

For an F# application, I attempted to follow these instructions:

How to force my .NET application to run as administrator?

Alas, Visual Studio does not have the same commands and project configuration pages for F# projects as for C# projects. I have created a throwaway C# project, copied its app.manifest into my F# project, and modified the <requestedExecutionLevel> as per the issue above. Nevertheless, the .exe still runs without administrator privileges.

So then, how do I build an F# application so that it only runs as administrator?

like image 958
Brad Collins Avatar asked May 27 '16 00:05

Brad Collins


People also ask

How do I not press Fn for F keys?

Method 1. Toggle the Fn Lock key All you have to do is look on your keyboard and search for any key with a padlock symbol on it. Once you've located this key, press the Fn key and the Fn Lock key at the same time. Now, you'll be able to use your Fn keys without having to press the Fn key to perform functions.

How do I force Fn key?

To enable FN Lock on the All in One Media Keyboard, press the FN key, and the Caps Lock key at the same time. To disable FN Lock, press the FN key, and the Caps Lock key at the same time again.


1 Answers

C# project files (.csproj) contain the following lines:

<PropertyGroup>
  <ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>

I just copied and pasted those lines into my .fsproj file just above the following line:

<Import Project="$(FSharpTargetsPath)" />

... and lo, my .exe now has the little shield badge on its icon and prompts me for elevated privileges every time I run it.

like image 185
Brad Collins Avatar answered Sep 20 '22 12:09

Brad Collins