0

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.
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Oct 19 '21 at 20:34
  • Thanks for addressing. solution test.sln which has 40 project in that solution. Whenever I try to build the solution .I want to clear the local NuGet packages at solution level in particular folder $(PackagesDir). – parru pooja Oct 20 '21 at 04:04
  • so it should trigger at solution level not at project level.it should trigger only once.so I have defined the following in nuget.targets file – parru pooja Oct 20 '21 at 04:12

0 Answers0