2

I want to add post build event to sign some project outputs by my signer app - this is the simple console application with the one action inside.

I had added this in the Post-build event command line window

$(OutDir)\Tools\SignTool.exe $(TargetPath)

On this command Visual Studio (2015) create a temporary exe for some reason in temporary folder and try to run it. My company's security settings block it and I think they right but build has failed.

Can somebody help to explain how to prevent VS to do this odd action and just run the *.exe or how to change the temp folder for VS without changing the global environment temp?

Kamerton
  • 315
  • 3
  • 9
  • I have a problem with antivirus being unable to whitelist MSVS generated executables as their names are generated randomly each time they're executed. So specifying a custom temp would've helped with AV exceptions. Also, it seems like in the past Visual Studio used to have the option to specify the location of its temporary files: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/7398351d-9cbb-488b-ac08-824306535495/change-where-visual-studio-writes-its-temporary-files?forum=vssetup – mireazma Mar 07 '21 at 20:44

1 Answers1

2

Not sure, if you still need an answer on this. We had the same issue here in our company (with VS 2019). Every Pre- or Postbuild event in your project will be automatically packed into one Batch-file (*.cmd). VS creates this batch file in the global temp path. As far as I know, you can't change this temp folder only for Visual Studio.

What we have done was creating a group policy for developers to enable batch creation by Visual Studio 2019 in temp folder. Now we are able to sign our EXE with Postbuild event (as you mentioned), and we can debug / run our applications with Visual Studio, finally.