Suppress Database Project errors and warnings in v

2020-06-30 08:44发布

I have an Database project in my application and want to suppress the errors/warnings thrown by this project. .first of all is it possible ?

I think I was not clear with my question, by suppressing I meant that when I build my Solution, the errors(which actually are not errors) are shown in the error list, I just want that all Database project related errors should not be shown in the error list.

I am using VS2010.

thanks in advance

10条回答
Summer. ? 凉城
2楼-- · 2020-06-30 09:25

To surppress a specific warning, go to project properties -> Build.

Type in the warning numbers in comma delimited format in field "Suppress Transact-SQL warnings:".

查看更多
三岁会撩人
3楼-- · 2020-06-30 09:29

You could remove the build/deploy of the project from your solution configuration. That way VS would not try to build the database project at all.

Of course any changes in the database project would be ignored.

To change or create a new solution file right click on the solution node in Solution Explorer and select properties. In that dialogue the configuration node (under Configuration Properties) tab and click configuration manager.

This allows you create new configurations and edit existing ones, and each configuration is mapped on to a project configuration (to add a new one select <new> on the active solution drop down).

Of course, the better approach is to fix the errors.

查看更多
我欲成王,谁敢阻挡
4楼-- · 2020-06-30 09:34

In VS 2015, you can suppress the warning 2 ways.

Project Level

I don't suggest this because I only like suppressing warnings if I know exactly what I am suppressing. In C#, for example, we can use SuppressMessageAttribute at a very granular level.

Nonetheless, here is how:

Right click database project > Properties > Build > Suppress Transact-SQL Warnings:

Enter the warnings you want to suppress such as 4151.

File Level

I prefer/suggest this option because it is more granular compared to above option.

Right click file in solution explorer1 > Properties > Suppress T-SQL Warnings

Enter the warnings you want to suppress such as 4151.


1. You must right click the file node in solution explorer. You will get a different options if you right click the file in editor.

There may exist another way but I only know of these 2 ways thus far.

查看更多
男人必须洒脱
5楼-- · 2020-06-30 09:34
  1. You may Exclude that project while build by right click on that project and choose 'Exclude Project'if Windows App. 'Unload Project' if Web App.

  2. To show/Hide Error list

    • Go to Tools > Options

    • Expand Projects and Solutions

    • Choose General.

    • On the right hand side, First check box is 'Always show Error List if build finishes with errors'

查看更多
登录 后发表回答