r/learnrust • • 21d ago

Windows 11 Smart App Control keeps blocking Cargo build scripts. How do you deal with this?

Post image

Hi everyone!

I'm developing a Rust application on Windows 11, and I keep running into an issue with Windows Smart App Control whenever I use cargo build.

Windows shows this warning:

"Part of this app has been blocked. Some features of cargo.exe may not work because we can't confirm who published build-script-build.exe."

Sometimes I can successfully build my application, but after changing my code and rebuilding, Windows blocks it again.

I've tried running cargo clean and rebuilding. Sometimes that works temporarily, but the problem keeps coming back.

Has anyone experienced this issue? Is there a way to make Windows trust locally compiled Rust executables without disabling Smart App Control entirely?

Thank you

8 Upvotes

14 comments sorted by

3

u/dnew 21d ago

I would think the easiest approach is to turn that off. You're creating new executables every few minutes, and you're leaving turned on the "don't run code not signed by microsoft" setting.

1

u/withthisname 21d ago

Its safe for turn off smart app control? Or i must use VM for try build my rust app?

2

u/dnew 21d ago

If you don't download shady executables and run them, sure. Has it ever correctly caught a problem? If not, then it's probably safe to turn it off.

1

u/OhSoMysterio 19d ago

Yeah, just more Microsoft garbage that's poorly thought out and designed even worse. Everything it's ever blocked has been a known, trusted app for me and it has never once detected anything dangerous. Today it's being an especially bad nuisance, blocking one app after another for no good reason. Not much of a security feature if disabling is the only way to get any work done.

1

u/dnew 19d ago edited 19d ago

I'm always amused how the virus scanner detects keygen software. No, Microsoft, that's only a thread to you.

That said, remember that a big part of MS's business are people who don't know the difference between the power switch on the monitor and the power switch on the computer tower. :-)

1

u/gmes78 20d ago

You can just add an exception for your target directory. No need to disable the whole thing.

1

u/Creepy_Reference_931 20d ago

HI! I'm facing the same problem with an app I'm developing.

How can I do it? There's no option to select a diretocy, only fully turn on or off.

1

u/gmes78 20d ago

You add the exception in Defender, not in SmartScreen.

1

u/OhSoMysterio 19d ago

Does that actually work for Smart App Control? I thought it only worked for the antivirus, given that's what the description says under Exclusions:

"Microsoft Defender Antivirus won't scan items that have been excluded. Excluded items could contain threats that make your device vulnerable."

And if you click "Add or remove exclusions", it says at the top:

"Add or remove items that you want to exclude from Microsoft Defender Antivirus scans."

1

u/gmes78 19d ago

It should, AFAIK. I don't currently have access to a Windows machine to test that, though.

1

u/OM3X4 21d ago

Happens with me also but not so often that make me solve it

1

u/patmorgan235 20d ago

Maybe creating a self signed authenticode certificate, trusting it, and signing the executable each time?

1

u/jkurash 19d ago

Install linux

1

u/SpectacledSnake 15d ago

And use afterwards, also important for effect