Home > Back-end >  Can you delete a specific file before building in Visual Studio 2019/2022
Can you delete a specific file before building in Visual Studio 2019/2022

Time:11-12

The project I am working on creates a cache file the first time it is built and ran, but if you make a code change and then re-run the project the file doesn't replace the cache and will instead run the old version of the code. To fix this you have to manually delete the file every time, but I was wondering if there is a way to get Visual Studio to delete that file any time it has to build/rebuild new code?

I am using a regular VS solution generated by CMake.

Thanks in advanced.

CodePudding user response:

A good idea would be use Visual Studio Build Events. Read the doc about how to personalize Build Events here. Using custom Build events you can run command before or after a compiling process.

  • Related