c# – Visual Studio Debugger reintroduces install dir files that PostBuildEvent deleted


My C# project references three files from a third-party SDK. By default, these files are written to the target build folder when I compile. But I don’t want them there (for complicated and irrelevant reasons). So I wrote a post build event to delete the DLLs after compilation:

  <<Target Name="PostBuild" AfterTargets="PostBuildEvent">
    <Exec Command="cd &quot;$(TargetDir)&quot;&#xD;&#xA;del MapInfo.RasterEngine.*.dll" />
  </Target>

This worked fine for a long time until I got a new laptop. On the new laptop, the compilation removes the files, but when I press F5 to run the code in the debugger, the files reappear (and my program throws an exception because ).

I have a workaround, so I am not looking for an alternative solution. I simply want to know why this is happening. Has anyone seen this before or can explain it?

Leave a Reply

Your email address will not be published. Required fields are marked *