我在 Visual Studio 2010 中有一个面向 SQL Server 2012 的数据库项目,并且至少有一个存储过程使用新语法重新抛出错误(“THROW;”)
尝试从命令行构建项目,如下所示:
msbuild /t:Build MyDatabaseProject.dbproj
输出这个:
Microsoft (R) Build Engine Version 4.0.30319.1
[Microsoft .NET Framework, Version 4.0.30319.269]
Copyright (C) Microsoft Corporation 2007. All rights reserved.
Build started 28.08.2012 13:14:23.
Project "F:\My\Path\MyDatabaseProject.dbproj" on node 1 (Build target(s)).
DspBuild:
Creating a model to represent the project...
Loading project files...
Building the project model and resolving object interdependencies...
Validating the project model...
F:\MY\PATH\SCHEMA OBJECTS\SCHEMAS\DBO\PROGRAMMABILITY\STORED PROCEDURES\SOMEPROC.PROC.SQL(95,3,95,3): Build error SQL02010: Incorrect syntax near THROW. [F:\My\Path\MyDatabaseProject.dbproj]
...
我的猜测是我应该添加一个参数来指定 SQL Server 2012 T-SQL 方言,但我不确定这一点。
从 Visual Studio 构建项目没有任何问题。
更新:我不确定我有什么类型的项目。项目属性如下所示:
附加数据: