One thing you can do is add a condition to the .csproj or .vbproj file that MSBuild will check when doing a build.
The condition would check if a publish is occurring and check if the build is a debug build, then do something like run an external tool or otherwise interrupt the build process or cause it to fail.
An example might be something like this:
<Choose>
<When Condition=" '$(Configuration)'=='Debug' ">
<Exec Command="C:\foo.bat" ContinueOnError="false" />
</When>
</Choose>
Where foo.bat is a batch file that return non-zero, thus stopping the publish from occurring.