Best practice concerning Script generation

We have several NSB projects using NSB5 with transport persistence of nhibernate. After upgrading to NSB6 we switched to Sql server persistence. During development everything works fine (because the nuget package NServiceBus.Persistence.Sql.MsBuild). When we deploy (we always set EnableInstallers to true) however the scripts are not available. They are not copied to the publishedWebsite folder.

What is the best practice in this approach?

Copy these manually
Can we get away with checking in our scripts? Can we change the folder in which the files are searched for by the NSB proces? (Controlling script generation • Sql Persistence • Particular Docs)
Only EnableInstallers during dev and manually run scripts on other environments?

Thanks for the feedback.


The preferred method is to run the scripts by some other facet of your deployment pipeline, under different credentials, so that the connection string used by SQL Persistence doesn’t have permission to modify the DB schema.

However, in your current case this should still work. What is responsible for deploying the DLLs? That process should be copying all runtime dependencies and that includes (in your case) the SQL scripts. Is it possible that copy process is just not set to do a recursive copy?