CIS Prevents Visual Studio Project Pre & Post Build Events [M1486]

A.CIS Prevents Visual Studio Project Pre & Post Build Events
Can you reproduce the problem & if so how reliably?:
Yes
If you can, exact steps to reproduce. If not, exactly what you did & what happened:
1:Building a C++ Project that has Pre & Post Build Events scripts fails. Although I use VBS scripts for these build events, it is not limited to them as simple commands as ‘cls’ (clear screen) also cause the error. I have supplied as an example a very small & simple project to show the issue.
2:Microsoft VS2013 copies the build event to a temporary file called “tmp<32 random hexadecimal characters>.exec.cmd” (for example: tmp6f8f82e3b1fd4243a5b34844c701d233.exec.cmd) into the directory defined by the environmental variable %Temp% (for example: “C:\Users\DevUser\AppData\Local\Temp”) and then executes it.
3:?
One or two sentences explaining what actually happened:
The build fails with the following error:
Error 1 error MSB6003: The specified task executable “cmd.exe” could not be run. The process cannot access the file ‘C:\Users\DevUser\AppData\Local\Temp\tmpac266f8be3254722852d102b547c8266.exec.cmd’ because it is being used by another process. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets 122 5 Twos
Whether the issue occurs depends in some way on whether it is a clean build or a rebuild. In general, it always happens if I clean the solution first and follow by either Build or Rebuild the solution (from the Build menu). Looking at the file afterwards it is empty. I should contain the following lines:

setlocal
set errorlevel=dummy
set errorlevel=
<the command string of the pre/post build event as specified in the VS2013 project>
:VCEnd
exit %errorlevel%

If CIS prevents these files from being executed, then they are empty and are not deleted.
One or two sentences explaining what you expected to happen:
The command to be executed.
If a software compatibility problem have you tried the advice to make programs work with CIS?:
No (Note this link is for V5 & V6 and not the current version 8).
Any software except CIS/OS involved? If so - name, & exact version:
I am using Microsoft’s Visual Studio 2013 Ultimate edition and git to download the Open Source project.
Any other information, e.g. your guess at the cause, how you tried to fix it etc.:
This problem had been reported to Comodo as #UEP-337-89386 in February 2015 and there have been numerous emails but I was advised to raise a problem on this forum instead.
The only solution I have found to work is to right click on the Comodo System Tray icon and exit the application and then use Task Manager to end the process “cmdagent.exe”. As I do not want to run unprotected, I have been doing my development within a Windows 7 VM (VirtualBox), which only has Microsoft Security Essentials installed whilst allowing my host to still be protected by CIS but this is unsatisfactory as a VM has less resources than my host system. I note that you said in 2010 that CIS does not work reliably when VirtualBox is installed but I do not use CIS within VirtualBox and I am hoping that in the 5 years since this was posted that there is no longer an issue having VirtualBox installed on the host.

I have also tried the following but neither worked:

  1. I added “C:\Users\DevUser\AppData\Local\Temp\tmp*.exec.cmd” to the Advanced Tasks → Open Advanced Settings → Antivirus → Exclusions → Excluded Applications. There doesn’t seem to be any Regex support to further limit this to “tmp” followed by 32 random hexadecimal characters before the “.exec.cmd” and I am not clear if an asterisk is permitted here.
  2. I added “C:\Users\DevUser\AppData\Local\Temp*” to the Advanced Tasks → Open Advanced Settings → Antivirus → Exclusions → Excluded Paths. However, I am not particularly happy about this as it would allow any temporary file to run without being checked. Unfortunately, Visual Studio does not let me specify where I want this temporary command file to be created and then run to reduce the exposure

B. YOUR SETUP
Exact CIS version & configuration:
CIS Internet Security Premium 8.2.0.4508 & with only Comodo Internet Security active

Modules enabled & level. D+/HIPS, Autosandbox/BBlocker, Firewall, & AV:
AV, Firewall, Autosandbox & Viruscope are enabled. Defense+/HIPS is not enabled
Have you made any other changes to the default config? (e.g. here.):
No
Have you updated (without uninstall) from CIS 5, 6 or 7?:
No
Have you imported a config from a previous version of CIS:
No
OS version, SP, 32/64 bit, UAC setting, account type, V.Machine used:
Windows 8.1 Pro 64-bit fully up to date. Local Administrator Account. I do use VirtualBox (V4.3.28) but do not run CIS on any guest VM within it.
Other security/s’box software a) currently installed b) installed since OS, including initial trial security software included with system:
No

[attachment deleted by admin]

I had a thought (no proof) - maybe it is a timing issue, which could explain why it doesn’t happen 100% of the time but at least 80%.

Maybe VS2013 creates the “tmp<32 random hexadecimal characters>.exec.cmd” file first and then CIS opens it to check the contents and so, when VS2013 then tries to edit it to put in the Pre or Post Build Event commands, it can’t as CIS has it open and so VS2013 responds “…it is being used by another process”.

This could also explain why it remains empty.

Thank you very much for your report in standard format, with all information supplied. The care you have taken is much appreciated by Comodo, and will increase the likelihood that this bug can be fixed.

Developers may or may not communicate with you in the forum or by PM/IM, depending on time, availability, and need. Because you have supplied complete information they may be able to replicate and fix the bug without doing so.

Many thanks again.

Hi c-273,

Could you create a video with exact steps?

Thanks a lot.

This link might possibly help with some ideas, though it’s an old one. See Paragraph D.
https://forums.comodo.com/defense-sandbox-faq-cis/preventing-files-being-bblocked-handling-bblocker-alerts-v6-t92892.0.html;msg669234#msg669234

Moving to “Incomplete” section.
Thank you.