FYI: Discover which objects have had warnings suppressed

    General discussion

  • I've just put together a bit of code that will look inside a .dbproj file and tell you which objects have had warnings suppressed. Its T-SQL code so you need to run it in Management Studio - just change the path to your .dbproj file.

    Hope this is useful!!

    DECLARE @xml xml;
    --SET @xml = 
    SELECT	@xml = CAST(pkgblob.BulkColumn AS XML) 
    FROM	OPENROWSET(bulk 'C:\Projects\SolnFolder\ProjFolder\ProjName.dbproj' -- <-Change this path!
    					,single_blob) AS pkgblob
    ;WITH XMLNAMESPACES( 'http://schemas.microsoft.com/developer/msbuild/2003' AS ns)
    FROM	(
    		SELECT	 build.query('.') AS [_node],
    				build.value('ns:SuppressWarnings[1]','nvarchar(100)') AS [SuppressedWarnings],
    				build.value('@Include','nvarchar(1000)') AS [ObjectPath]
    		FROM	@xml.nodes('//ns:Build[ns:SuppressWarnings]') AS R(build)


    http://sqlblog.com/blogs/jamie_thomson/ | @jamiet | About me
    Jamie Thomson
    Monday, January 17, 2011 3:52 PM

All replies