Generate script from CodeSmith without executing the resultant script against the database

StackOverflow https://stackoverflow.com/questions/14574187

  •  05-03-2022
  •  | 
  •  

Question

I have a fairly simple question - how do I generate a script from a CodeSmith template (.cst) without the generated script being run against the target database.

That is, I have a CodeSmith template file that generates CRUD SQL Server stored procedures via the following command

cs.exe "GenerateCrud.csp" -p:TargetDB=mySqlServerDb -p:TargetServer=mySqlServerInstance

...where GenerateCrud.csp invokes a template that runs against the two parameters TargetDB and TargetServer

The requirement is to generate the CRUD script without running the script against the TargetDB and TargetServer. Is there a commandline argument that accomodates this ?

Was it helpful?

Solution

Which template are you using? You'll likely find there's a property inside that csp file, e.g. "AutoExecuteStoredProcedures"

You can change that from the command line, without editing the csp file itself, as you are with the other properties, e.g:

cs.exe "GenerateCrud.csp" -p:AutoExecuteStoredProcedures=false

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top