简体   繁体   English

msbuild忽略ValidateCasingOnIdentifiers用SSDT sqlproj生成sql

[英]msbuild ignores ValidateCasingOnIdentifiers generating sql with SSDT sqlproj

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]. 我将sqlproj设置为不验证标识符的大小写,但是当我使用msbuild生成sql脚本时,它似乎会忽略并显示类似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. 请注意,在Visual Studio中进行构建时,未按预期显示警告。

Here's what I'm running at cmdline: 这是我在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. 我还尝试将/p:ValidateCasingOnIdentifiers=False添加到msbuild命令中,但这也不起作用。

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. 我确认我的sqlproj中有一行<ValidateCasingOnIdentifiers>False</ValidateCasingOnIdentifiers> ,当我单击Visual Studio中项目属性GUI中项目设置中的复选框时,该行放在了那里。

I got it to work by adding a line in my sqlproj file, directly under where I had <ValidateCasingOnIdentifiers>False</ValidateCasingOnIdentifiers> : 我通过在sqlproj文件中的<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 本文使我发现: https : //developercommunity.visualstudio.com/content/problem/19394/unable-to-suppress-build-warnings-for-sql-db-proje.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM