Error trying to run project. Access is denied (But user has access to the project folder)

87 Views Asked by At

I can't seem to run a simple console application that just prints out "Hello World" and then a Readline() to end the program.

NB, this happens only on my work PC. I don't have this problem on my personal PC.

I explain what I have done.

Visual Studio: Community 2022 (64-bit) - Version 17.8.5
OS: Windows 11 Business Version 10.0.22631

In Visual Studio, when I run the project I get the following error:

Error while trying to run project: Unable to start program [PATH TO EXE FILE]

Access is denied

enter image description here

I then open the project folder in Windows Explorer and manually run the exe file in the Debug folder. I get a similar error message with slight different wording that says:

Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access the item.

enter image description here

It seems like there is a user rights problem. I open the security properties of the containing folder and notice that my user is mentioned and it has Full Control authority over the folder.

enter image description here

Mind that in my Windows Security settings, I have also tried deactivating the Reputation-based Protection to allow running unrecognized apps and files. Althrough, this is not recommended, but I have done it just to see if it makes any difference.

enter image description here

As I said, none of this is required in my personal PC where I run the exact same program. I am running out of ideas where to look.

1

There are 1 best solutions below

1
Alex Trême On

The likely cause is:

  1. Microsoft Defender exploit Guard, new default aggressive rules for attack surface reduction
  2. Our IT administrator team now even block vanilla apps.exe

See Event Viewer -> Application and service logs -> /Microsoft/Windows/Windows Defender/Operational

In my case, I see events that indicate threat protection is the cause.

Here is the copilot translation of my french error message from eventvwr:

Microsoft Defender Exploit Guard has blocked an operation that is not authorized by your IT administrator. 
For more information, contact your IT administrator. 
ID: 01443614-CD74-433A-B99E-2ECDC07BFC25 
Detection Duration: 2024-01-22T20:10:46.962Z 
User: _ 
Path: C:\Users_\source\repos____.exe 
Process Name: C:\Windows\explorer.exe 
Target Command Line: 
Parent Command Line: C:\WINDOWS\Explorer.EXE 
Affected Folder: 
Inheritance Indicator: 0x00000000 
Security Intelligence Version: 1.403.2529.0 
Engine Version: 1.1.23110.2 
Product Version: 4.18.23110.3

Original French event:

Microsoft Defender exploit Guard a bloqué une opération qui n’est pas autorisée par votre administrateur informatique.
 pour plus d’informations, contactez votre administrateur informatique.
    ID : 01443614-CD74-433A-B99E-2ECDC07BFC25
    Durée de détection : 2024-01-22T20:10:46.962Z
    Utilisateur : ____\____
    Chemin d’accès : C:\Users\____\source\repos\______.exe
    Nom du processus :  C:\Windows\explorer.exe
    Ligne de commande cible : 
    Ligne de commande parents : C:\WINDOWS\Explorer.EXE
    Dossier concerné : 
    Indicateur d'héritage : 0x00000000
    Version de la veille de sécurité : 1.403.2529.0
    Version du moteur : 1.1.23110.2
    Version du produit : 4.18.23110.3