I set my sqlproj to not validate casing on identifiers, but when I generate a sql script with msbuild, it seems to ignore that and shows warnings like warning SQL71558: The object reference [dbo].[table].[deleted] differs only by case from the object definition [dbo].[table].[Deleted].
.
Note when building from within visual studio, the warnings are not shown, as expected.
Here's what I'm running at cmdline:
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe" /p:Configuration=Release /p:Platform=AnyCpu /p:TargetDatabaseName=dbName /p:TargetConnectionString="Data Source=.\SQLExpress;Initial Catalog=dbName;Integrated Security=True" /p:DeployScriptFileName=publish.sql /p:UpdateDatabase=False /p:CommentOutSetVarDeclarations=True /t:Rebuild,Deploy "c:\dev\project\Sql.sqlproj"
I also tried to add /p:ValidateCasingOnIdentifiers=False
to the msbuild command, but that didn't work either.
I confirmed that my sqlproj has the line <ValidateCasingOnIdentifiers>False</ValidateCasingOnIdentifiers>
that was put there when I clicked the checkbox in project settings in the project properties GUI in visual studio.
I got it to work by adding a line in my sqlproj file, directly under where I had <ValidateCasingOnIdentifiers>False</ValidateCasingOnIdentifiers>
:
<SuppressTSqlWarnings>71558</SuppressTSqlWarnings>
This article lead me to find that: https://developercommunity.visualstudio.com/content/problem/19394/unable-to-suppress-build-warnings-for-sql-db-proje.html