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
5:
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.
-GertD
Comments
Anonymous
January 11, 2009
The comment has been removedAnonymous
January 11, 2009
Gert from the Visual Studio Team System For Database Professional (Data Dude) just posted how to suppressAnonymous
January 13, 2009
Martin Hinshelwood on Installing Visual Studio 2008 Team Suite on Windows 7 Manish Sharma on TFS WorkItemAnonymous
February 07, 2009
[ Nacsa Sándor , 2009. február 8.] Ez a Team System változat az adatbázis változások kezeléséhez és teszteléséhezAnonymous
April 07, 2009
Will suppressing this warning (4151) mask warnings about missing references to persistent objects?Anonymous
April 22, 2009
If a temp table is not a valid warning scenario why is it being thrown in the first place? Is there any guidence as to when to suppress the 4151 message? Consider the following how do I specifiy where to find Cert_DataProKey? I think it is ok to suppress but not shure. OPEN SYMMETRIC KEY DataProtection_Key DECRYPTION BY CERTIFICATE Cert_DataProKeyAnonymous
December 17, 2009
Awesome! I was really concerned that I was going to miss meaningful warnings just because I didn't want to see warning from objects that I don't control/can't change.