In my csproj, I am importing a very large heavily used targets file (which I not allowed to break down as of now). This targets file however, sets up various target dependencies / order by using AfterTargets='Build'.
In the csproj where I import this large targets file, I want to remove some of the After build target dependencies. For example, say the following target gets imported:
<!-- This is in the large targets file -->
<Target Name="Target1" AfterTargets="Build">
</Target>
How do I remove Target1
from being executed After build in the csproj I am importing it in.
What is a good way to accomplish that?
You have to overwrite the target
Target1
and then set an empty for its target that means you have removed the previousTarget1
.Although it still appear on the build log, it is empty with no operation. That is the only way. And if you want to make
Target1
not appear, you have to delete it under the large targets file.You should note that you must write the new
Target1
after the previous one to make the new one overwrite the old one.For an example,