Ok so if you are using a database project and you want to turn on notifications for the database once it is deployed so you can use handy things like "SqlCacheDependency" a good way I found was to add a “AfterDeploy” target to the “*.dbproj” file for the database project and then just call “aspnet_regsql”. This way you don’t have to remember to run the command each time you deploy the database from scratch and I think it’s cleaner than having explicit try/catch logic within your application to setup the notifications.
<Target Name="AfterDeploy">
<Exec Command="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql.exe -d FakeDataBaseName -ed -S . -E" ContinueOnError="true" />
<Exec Command="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql.exe -d FakeDataBaseName -S . -E -et -t FakeDataBaseTable" ContinueOnError="true" />
</Target>