I am looking for a way to run my defined Target only once per build process and not for every project that gets build.
I have defined the following in nuget.targets file
<Message Text="custom clear!!!" Importance="High" />
<ItemGroup>
<_tenant Include="$(PackagesDir)\Tenant.1.1.0\**\*">
</ItemGroup>
<Delete Files="@(_tenant)">
<RemoveDir Directories="$(PackagesDir)\Tenant.1.1.0\>
</Target>```
Should only run once no matter how many projects the msbuild process is building, currently it happens for each project.
It shouldn't matter if I hit (Re-)Build Soltution or (Re-)Build [ProjectName] or hit F5 in Visual Studio, as long any build happens I want to exectue MyTarget only once.