1

I am trying to record the last access time of all the apps intalled in a pc, i have the next code:

System.IO.File.SetLastAccessTime(appList[offSet], DateTime.Now);

I understand that i need to give permissions to make this operation, i alreay try a manifest file with the next line:

<requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />

But when i run my program, the next error appears:

Error ClickOnce does not support the request execution level 'requireAdministrator'

How can i solve this problem?

Fernando Santiago
  • 2,128
  • 10
  • 44
  • 75
  • Hmm, a quick Google search on your error gave me the answer. – lc. Jul 14 '12 at 18:14
  • if it is the FileIOPermission f, it did not work – Fernando Santiago Jul 14 '12 at 18:16
  • In fact, http://stackoverflow.com/questions/5713825/run-as-administrator-requireadministrator-clickonce-emulating-system-time is a dup. – lc. Jul 14 '12 at 18:17
  • 2
    @lc. He's not trying to change the system time... he needs to disable ClickOnce deployment. Btw, I hate answers that doesn't solve problems. – Chibueze Opata Jul 14 '12 at 21:18
  • @ChibuezeOpata Yes, the exact task to be done is different, but the means/issue (requiring admin privileges from ClickOnce) is exactly the same and the answer will be as well. If that doesn't qualify as a dup, we may as well have 1000 different questions enumerating different reasons to need admin privileges... – lc. Jul 14 '12 at 21:29
  • @lc. Yes, but the answer stated there does not solve his problem. And yes, different reasons may mean different solutions or approach to a problem. – Chibueze Opata Jul 15 '12 at 09:06

2 Answers2

0

The account under which this application is running is what needs the permissions.

Setting requestedExecutionLevel will only work if the account has the required permissions.

Oded
  • 489,969
  • 99
  • 883
  • 1,009
0

Try to go to your project properties in Visual Studio, in the security tab un-check "Enable ClickOnce security settings". i think it will solve your problem.

Shahar Gvirtz
  • 2,418
  • 1
  • 14
  • 17