FSIBLOG

“An Application Control Policy Has Blocked This File” in VS Code: Smart App Control Switched Itself On, and Your Own Compiled .exe Is Unknown to Windows

Fix "Application Control Policy Blocked This File" VS Code

Yes, it is okay to turn Smart App Control off on a personal PC where you compile your own programs, and for C++ in VS Code it is the direct fix. The error does not come from a virus, a broken compiler or a company policy. Smart App Control finished its evaluation period and moved to On, and in that state Windows blocks every program that is neither signed by a trusted publisher nor known to Microsoft's cloud. A fresh div2B.exe is neither. Event ID 3077 in Event Viewer is the record of that block. The old warning that you must reinstall Windows to switch it back on is out of date on current builds. Two fixes follow: switch it off, or keep it on and build inside WSL.

Confirm in One Minute That Smart App Control Is the Blocker

Save the script below as sac-check.ps1. It reads the state from the registry, prints your Windows build, and lists the last files that event 3077 recorded.

# sac-check.ps1 - shows whether Smart App Control is the thing blocking your .exe
$state = (Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\CI\Policy' `
          -Name VerifiedAndReputablePolicyState -ErrorAction SilentlyContinue).VerifiedAndReputablePolicyState
$names = @{ 0 = 'Off'; 1 = 'On (blocking unknown apps)'; 2 = 'Evaluation (watching, not blocking)' }
"Smart App Control : " + $(if ($null -eq $state) { 'not present on this PC' } else { $names[[int]$state] })

$cv = Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion'
"Windows build     : $($cv.CurrentBuild).$($cv.UBR)   (the on/off switch without reinstall needs 26100.8116 or 26200.8116 and later)"

"`nLast blocked files (event 3077):"
Get-WinEvent -FilterHashtable @{ LogName = 'Microsoft-Windows-CodeIntegrity/Operational'; Id = 3077 } `
             -MaxEvents 5 -ErrorAction SilentlyContinue |
  ForEach-Object { "  {0:yyyy-MM-dd HH:mm}  {1}" -f $_.TimeCreated, ($_.Message -split "`n")[0] }
What a blocked PC prints (your build number will differ)
Smart App Control : On (blocking unknown apps)
Windows build : 26200.8116 (the on/off switch without reinstall needs 26100.8116 or 26200.8116 and later)

Last blocked files (event 3077):
2026-11-16 13:02 Code Integrity determined that a process (...powershell.exe) attempted to load
\Device\HarddiskVolume5\CODEFORCES\div2B.exe that did not meet the Enterprise signing level...
powershell -ExecutionPolicy Bypass -File .\sac-check.ps1
citool.exe -lp

Why It Worked for Three Months and Stopped Today

Switch Smart App Control Off

  1. Press Start, type Windows Security and open it.
  2. Open App & browser control.
  3. Click Smart App Control settings.
  4. Select Off and confirm.
  5. Go back to VS Code and run the program again. No restart is needed in most cases.

What You Give Up and What Stays

The Reinstall Warning Is Old on Current Windows

Until spring 2026 the Off choice was final, and only a reset or a clean install brought the feature back. The April 2026 update (KB5083769) changed that. From builds 26100.8116 (24H2) and 26200.8116 (25H2) you can switch it on again in the settings page you just used. Your build number is the second line of the check script.

Keep It On and Build Inside WSL

The advice you got about WSL is sound, and it is not a workaround in the bad sense. WSL runs a real Linux system next to Windows. Programs you compile there are Linux programs, and Smart App Control checks Windows programs only. You keep the protection for everything you download and still run your own code freely.

wsl --install

After the restart, Ubuntu opens and asks for a user name and a password. Then install the compiler.

sudo apt update && sudo apt install -y g++ gdb

Your Windows drives appear under /mnt, so the existing folder needs no copying.

cd /mnt/d/CODEFORCES
g++ -std=c++17 -O2 -Wall -o div2B div2B.cpp
./div2B < input.txt

Output of the sample program below, run on Ubuntu for this article

Output of the sample program below, run on Ubuntu for this article
6 3
4 7
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        long long sum = 0, best = LLONG_MIN;
        for (int i = 0; i < n; i++) {
            long long x;
            cin >> x;
            sum += x;
            best = max(best, x);
        }
        cout << sum << ' ' << best << '\n';
    }
    return 0;
}
2
3
1 2 3
4
-5 7 0 2

Connect VS Code to WSL

  1. In VS Code on Windows, install the extension named WSL by Microsoft.
  2. In the Ubuntu terminal, go to your folder and type the command below. VS Code opens with “WSL: Ubuntu” in the bottom left corner.
  3. Install the C/C++ extension when VS Code offers it for WSL.

Ubuntu terminal · opens VS Code connected to WSLCopy

code .

Build and Run With One Key

Create a folder named .vscode in your project and put this file in it. Ctrl+Shift+B then compiles the file you are looking at and runs it with input.txt.

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Build and run (g++ in WSL)",
      "type": "shell",
      "command": "g++ -std=c++17 -O2 -Wall -o ${fileBasenameNoExtension} ${file} && ./${fileBasenameNoExtension} < input.txt",
      "options": { "cwd": "${fileDirname}" },
      "group": { "kind": "build", "isDefault": true },
      "problemMatcher": ["$gcc"]
    }
  ]
}

Choose Between the Two Fixes by What Else You Do on the PC

Exit mobile version