Hello @67883078,
I think you have got the answer/solution here: Why are the C# pre-build and post-build events not called if I import a custom target with my own build target in it?
As a summary, the default target, Build target, was overridden in your .targets file. However, the "new" Build target didn’t depend on the pre-build event target and the post-build event target, which made them didn’t start when you were building the project.
The key is that do not simply override the default target(pick a different custom target name).
BTW, as we mention "override", one thing to note again is that the order is very important in the project file(.csproj file).
Feel free to contact us if you have any further concerns:)
Have a great day!
Best Regards,
Tianyu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.