Reputation: 4938
How can I stop VS2010 showing errors in .sql files, attached to a project? I don't want to check them at all, just C# code. The files are used as resources, Build Action set to Content. I'd like to keep .sql extension for syntax coloring purpose.
Regards,
Upvotes: 31
Views: 16082
Reputation: 11
Steps to stop showing SQL errors in bulk:
.sqlproj
extension in a text editor.<Build Include=
with <None Include=
. (This one has the same effect as right-clicking and changing Build Action to None in the solution explorer.)Upvotes: 1
Reputation: 1120
right click in editor of the sql file > Intellisense Enabled
Upvotes: 10
Reputation: 181
In VS 2012.
Unfortunately you have to do this for each sql file in the project.
This is what gave me the behavior that I wanted. It not only compiles without errors but shows no sql related build errors.
Update
It is possible to select multiple files in Solution Explorer by using Shift + Click
(select the file at the top of the list -> hold down shift -> click the file at the bottom of the list). Once you have selected the group of files, you can then change the Build action to None for all of them at once. (This worked for me in VS2013.)
While you still have to select files per folder you don't have to select each file to set the property.
Upvotes: 15
Reputation: 779
Looks like your question was answered here: https://stackoverflow.com/a/8593877/2798869:
Tools -> Options -> Text Editor -> Transact-SQL -> IntelliSense
Uncheck "Enable IntelliSense".
Tools -> Options -> Text Editor -> SQL Server Tools -> IntelliSense
Uncheck "Underline errors"
Note that you have to close then re-open any .sql files you may have open.
Upvotes: 44
Reputation: 181
May be a sledge hammer to the problem but I manually deploy my SQL changes and only use them to house the scripts for my builds, so I do not need the functionality provided by SQL Projects.
Open the VS Solution File properties (right-click the solution in VS Solution Explorer and select Properties) and in the left pane select "Configuration Properties" -> "Configuration". In the right-pane you will see the projects in the solution. Un-check these projects to prevent them from building, this will prevent them from showing errors.
Upvotes: 3
Reputation: 1068
I just built a test project with one class file .cs and added one .sql file. It automatically set the build type to content. It built fine like John Fraser said in VS2010, so I changed it to compile, and obviously it failed.
This isn't the answer yet but perhaps the next step is to try and create a new solution, and import a few of the files from the original project to try to narrow down the source of the problem. If it builds then it would tell you it is something about the settings in your project/solution. Otherwise it could also be a VS setting.
Upvotes: 1
Reputation: 58
Change the type of files to content and then the intellisense will never try and parse the contents of the files.
Upvotes: 1
Reputation: 400
Is it possible you have a .cs extension on those files but it's not shown? I added some .sql files to my project and the compiler is not complaining.
Upvotes: 1