Issue with suppressing errors in SSDT (SQL Server Data Tools)
Asked Answered
L

2

12

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

Error 4 SQL71561: View: [dbo].[x] has an unresolved reference to object [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.

Is there a better approach?

Lobectomy answered 27/3, 2012 at 17:28 Comment(2)
Any news on this one? I have the same problem at the moment. But I cannot change the build action, because it's not going to deploy the view if I change it.Sihonn
I also could not figure out how to suppress these errors, so I added a reference to the other database to resolve the errors. See stackoverflow.com/questions/12161392 for details.Canescent
C
6

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:

  • 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.
  • Create a stub project (e.g. a fake DB1) side-by-side with yours, reference it, and add the stub objects there.

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

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:

SqlPackage /Action:Extract /SourceServerName:YourServerNameHere /SourceDatabaseName:YourDatabaseNameHere /TargetFile:YourDatabaseNameHere.dacpac
Chromatolysis answered 8/2, 2014 at 18:52 Comment(1)
This link is deadCasandra
P
-4

on the publish database dialogue box > advanced > check the 'treat verification errors as warnings'

Publish Database and Advanced Publish Settings

Pitts answered 25/5, 2012 at 2:35 Comment(1)
This doesn't remove build errors and comparisons will not work until build errors are resolved.Phil

© 2022 - 2024 — McMap. All rights reserved.