Visual Studio: the file contains a virus?!

A few days ago I started receiving the following messages from Windows Defender:

Microsoft Visual Studio: Unable to start program 'C:\CPP\...\w.exe'. Operation did not complete successfully because the file contains a virus or potentially unwanted software.

At the beginning it didn't bother me much, since project rebuild usually helped.

But finally Defender "promoted" me (along with my w.exe) to a VERY black list and stopped letting it run unconditionally. Plus started deleting it from the drive.

Well, sometimes AntiVirus apps behave worse than some viruses. Hell knows what can trigger their attention.

Turned out that it's quite common problem, well known to many programmers. If you are one of them (of us), then here is a cure:


How to stop AntiVirus' false alarms

Just exclude your exe file from AntiVirus' consideration.

This guide is for Windows Defender. If you are using something else, then steps most likely will differ, but you see the idea.

Open your AntiVirus control panel:

  1. Open Windows Start menu.
  2. Type and run Windows Security app.
  3. Open Virus & threat protection section.

Find Exclusions section:

  1. Under Virus & threat protection settings open Manage settings.
  2. Scroll down to Exclusions section
  3. Proceed to Add or remove exclusions.

Exclude your work folder from AntiVirus' check list:

  1. Proceed to Add an exclusion.
  2. Pick Folder mode.
  3. Select C:\CPP.

That's it. It won't bother you any more.


Leave a Reply

Your email address will not be published. Required fields are marked *