I have a database project in Visual Studio 2010 that targets SQL Server 2012 and at least one of the stored procedures uses the new syntax for rethrowing errors ("THROW;")
Trying to build the project from command line like so :
msbuild /t:Build MyDatabaseProject.dbproj
outputs this :
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]
...
My guess is that I should add a parameter to specify the SQL Server 2012 T-SQL dialect but I am not sure about this.
Building the project from Visual Studio works without any issues.
UPDATE : I am not exactly sure what type of project I have. The project properties looks like so :
Additional data :