-1

I have a very simple VS2015 solution with one project. The project does not have any source code, but it has a pre-build event defined. The pre-build event was originally invoking a batch file pb.bat, but I have since changed it to REM pb.bat so that it only executes the REM statement.

Every time I try building, I get the following error message:

Microsoft.Common.CurrentVersion.targets(1250,5): error MSB6003: The specified task executable "cmd.exe" could not be run. The requested operation requires elevation

I should note that UAC is disabled. This is driving me crazy! I have even tried reinstalling Visual Studio, in case the targets files or something else was corrupt with the installation, but the problem persists. If I run Visual Studio as an Administrator, the build works, but I don't want to have to run it like that forever!

Philip Atz
  • 886
  • 1
  • 10
  • 26

1 Answers1

0

I had completely forgotten about this! A couple of days ago I had configured cmd.exe to always run as an Administrator. This was done in the registry:

[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers]
"C:\\Windows\\System32\\cmd.exe"="RUNASADMIN"

The problem went away as soon as I reverted the change. I am making a note of this, as I am bound to hit the same problem in the future.

Philip Atz
  • 886
  • 1
  • 10
  • 26
  • Thanks! I have to wait until tomorrow before I can mark this as the answer. – Philip Atz Mar 03 '17 at 10:48
  • 1
    Glad to know that you have resolved this issue. Please mark your answer which is benefit to other communities who has the same problem. – Leo Liu Mar 06 '17 at 09:52