抑制SSDT中的錯誤的問題(SQL Server數據工具) - Issue with suppressing errors in SSDT (SQL Server Data Tools) -开发者知识库

抑制SSDT中的錯誤的問題(SQL Server數據工具) - Issue with suppressing errors in SSDT (SQL Server Data Tools) -开发者知识库,第1张

It looks like SSDT supports only suppressing warnings but not errors. I have many errors, all stating:

看起來SSDT僅支持抑制警告但不支持錯誤。我有很多錯誤,都說明:

Error 4 SQL71561: View: [dbo].[x] has an unresolved reference to object [DB1].[dbo].[y].[column]

錯誤4 SQL71561:視圖:[dbo]。[x]有一個未解析的對象[DB1]的引用。[dbo]。[y]。[column]

I do not want to reference DB1 in this database project, for specific reasons. I just want these errors to be ignore when I build the project. The only way I have been able to get ride of these errors is to go to each file (view) and set the Build Action to None. Suppressing TSql Warnings at the project level or the file level does not work (I'm assuming this only suppresses warnings). And, I have not set the option to treat T-SQL warnings as errors.

出於特定原因,我不想在此數據庫項目中引用DB1。我只是想在構建項目時忽略這些錯誤。我能夠解決這些錯誤的唯一方法是轉到每個文件(視圖)並將Build Action設置為None。在項目級別或文件級別禁止TSql警告不起作用(我假設這只會抑制警告)。而且,我沒有設置將T-SQL警告視為錯誤的選項。

Is there a better approach?

有更好的方法嗎?

3 个解决方案

#1


5  

I haven't found how to avoid the error without referencing DB1, but there are two options to go about it if you don't have the code for it in SSDT:

我沒有找到如何在不引用DB1的情況下避免錯誤,但是如果你在SSDT中沒有它的代碼,有兩個選項可以解決它:

  • If you have access to the live DB1, extract a .dacpac out of it using SqlPackage. Then add this .dacpac as a reference in your project.
  • 如果您有權訪問實時DB1,請使用SqlPackage從中提取.dacpac。然后將此.dacpac添加為項目中的參考。
  • Create a stub project (e.g. a fake DB1) side-by-side with yours, reference it, and add the stub objects there.
  • 創建一個存根項目(例如假的DB1)與您並排,引用它,並在那里添加存根對象。

I had to use option 1 with a project a while ago, which I detailed here:

我不得不在前一段時間使用選項1,我在這里詳述:

http://tangodude.wordpress.com/2014/02/05/referencing-the-sql-server-data-collectors-management-data-warehouse-in-your-ssdt-database-project/

http://tangodude.wordpress.com/2014/02/05/referencing-the-sql-server-data-collectors-management-data-warehouse-in-your-ssdt-database-project/

You can extract a dacpac by using this:

您可以使用以下方法提取dacpac:

SqlPackage /Action:Extract /SourceServerName:YourServerNameHere /SourceDatabaseName:YourDatabaseNameHere /TargetFile:YourDatabaseNameHere.dacpac

最佳答案:

本文经用户投稿或网站收集转载,如有侵权请联系本站。

发表评论

0条回复