问题
I have a database project in Visual Studio 2013, with a post deployment script that uses SQLCMD mode.
The problem I am having is that the project defaults to non-SQLCMD mode every time the project is opened. This means that every time the project is opened, the Error List will be flooded with errors like "Incorrect syntax near ':'." until the developer opens the deployment script and clicks the SQLCMD Mode button.
Is there a way to default to keeping SQLCMD Mode on so developers don't have to do this each time they open the project?
回答1:
Had to dig a little for this one:
Go to the Tools|Options menu, then expand to SQL Server Tools, Transact-SQL editor, Query Execution. There's a setting in there to click that says "By default, open new queries in SQLCMD mode".
However, this shouldn't throw any errors/warnings unless you have that particular script open unless there's something new in VS2013 that changes that behavior.
This looks like a local option so would need to be set for each developer.
来源:https://stackoverflow.com/questions/22057776/is-it-possible-to-make-sqlcmd-mode-sticky-in-database-projects