File Level Build Warning Suppression in the GDR

One of the small, but hard to discover new features in the GDR release is the ability to suppress warnings at the file level. Just to be very clear, this is suppression of build level warnings, not of static code analysis or deployment warnings!

Imagine you have a procedure that references a temp table that is created either dynamically or in some other procedure.

    1:  CREATE PROCEDURE [dbo].[Procedure1]
    2:  AS
    3:  BEGIN
    4:      SET NOCOUNT ON
    6:      SELECT c1 FROM #t1
    7:  END

The system will raise a warning "TSD04151: Procedure: [dbo].[Procedure1] has an unresolved reference to object [#t1]."


You could always suppress build warnings at the project level using the "Suppress Warnings" option on the Build tab.


In the GDR you can also suppress warnings at the file level, using the Properties window. You have to select the file which contributes the warning in Solution Explorer. If the Properties window is not visible you can hit F4 or right click on the file name and select Properties. This will bring up the Properties window. This contains a file level option for suppressing build warnings. By providing the warning number, 4151, without the TSD prefix you suppress the "TSD04151: Procedure: [dbo].[Procedure1] has an unresolved reference to object [#t1]." for the procedure inside the file.


This little enhancement hopefully provides you with a more fine grain weapon against pesky warnings that otherwise would not go away.