UAC Enable your C# Application
I recently ran into an issue with a desktop side application I was developing that did some manipulation against some files in the program files direction. Because of the permissions assigned on that directory a person with UAC turned on couldn’t run the application and was presented with a very nasty .Net exception box.
The fix was to have the application always run in admin mode, removing the permissions issue. With some Googling I determined that all I needed to do was click the “View UAC Settings” button in the Application Properties. But wait, that is VB only apparently.
To get this working what I had to do was add the Application Manifest File from the “Add New Item” dialog.
Then once it was added to the solution I opened it up and changed one line from:
to
I then re-compiled and it was good to go, the little shield appeared on the executable image without any other work required. It too me a few searches before I found anyone that mentioned C# not having the "View UAC Settings” button and you had to add the file manually. It’s a shame that MS is still having VB.Net so drastically different from C# from a Visual Studio UI side in things like that. Apparently they are under the distinct impression that we need to spend more time on ‘plumbing’ and not working on our business logic.