r/visualbasic • u/Thunor_SixHammers • Jul 09 '21
VB.NET Help Windows keeps deleting my .exe, thinking it's a virus.
As of a week ago, a program I made (a discord bot) which had been running for many weeks straight without any issue; shut down and the exe was deleted. I rebuilt and it ran for a bit, then it was deleted.
Windows defender classified it as harmful and was removing it.
I added it to the safe list. No luck. I deactivated windows firewall (and defend?) No luck
Any help?
12
Upvotes
5
u/fasti-au Jul 09 '21
Make a folder I c:\bypassav and add the folder as an exclusion under windows defender then put your exe in there.
2
u/Buy_The_Ounce Jul 09 '21
This happened to me recent in an application I made that does a web request to scrape some information. Windows says it’s a Trojan
3
u/JamesWasilHasReddit Jul 09 '21
Windows did that to me in a VM when I used a cool trick to save and store data that normally would have had to be a separate file and added it to the end of an EXE with a known size (padded to X bytes, then anything after X bytes was program data or a virtual file system for the program). Windows didn't like that.
Anything creative is considered a "virus" by Microsoft cancer and gets deleted by Defender, Avast, Norton, McAfee, AVG, and others.
I was able to get around this by using an EXE packer and passing my exe to that and then using a post-compiler to do padding for the output EXE to the same byte size for the data and virtual file system to still work.
Check out a compressor called Crinkler and another called UPX to see if packing the EXE will make it not freak out. At times AVs won't run packed exes, but with this it had the opposite effect and worked to fix that. See if using either of those helps.
2
u/Tenragan17 Jul 09 '21
The real way to handle this is too sign the app at compile time. You'll need an ssl cert which you can generate for free but it won't be backed by a recognized authority so that is only a temporary fix.
You can find tutorials on how to go through the signing process online pretty reliably so just Google around.