Is there any way to delete the output file in the event after the build

I am trying to run a post-build batch file in .NET build that encrypts the output file, deletes the original, and then renames the encrypted version to the original name of the output file. i.e:.

Build A, then in post build:

  • Encryption A-> B,
  • DEL / FA,
  • RENAME B A.

It seems that I can not delete the original output file after encryption, although it seems that there is a file lock by the installer project (or maybe the project itself?). I tried to force delete, but this is not only a read-only attribute, but also a complete lock. Is there any way around this?

+3
source share
3

. . , Studio MSBuild .

+2

, , , - ....

, OP, , - .

, :

del $(ProjectDir)UnwantedFile.txt

, , , del .

:

del "$(ProjectDir)UnwantedFile.txt"

, , .

:

Encrypt "$(A)"->"$(B)"
del /F "$(A)"
rename "$(B)" "$(A)"
+2

DLL ? Visual Studio referendestend (DLL, EXE ) . , , , , SysInternals Handle Utility . devenv.exe, , , , , , , , .

0

Source: https://habr.com/ru/post/1711498/


All Articles