How can I turn off specific TSql warnings for files generated from a T4 template? - sql-server

I have a T4 template that generates a lot of SQL code, for which I have lots of SQL71502 and SQL71562 warnings.
These warnings are expected and I want them ignored for that specific file.
I tried using the generated file properties to turn them off. It works, but the "Suppress TSql Warnings" property value gets cleared each time the template runs so it's pointless.
I don't want to disable these warnings on the whole project and the pragma instruction isn't supported AFAIK.
So far my only option seems to be using EnvDTE api, which I'd very much like to avoid.
Can anyone help?

How about putting them all in a separate project and disabling the warnings there and using "same database" references to the main project (would be hard if you reference the generated objects and back to the main project)
Otherwise the dte api, it isn't that hard to enumerate all project items and check the properties I can point to a sample if you need one.
Ed

You can ignore the tsql warnings on a per file basis in the properties dialog of the specific file:

Related

JDeveloper deleting ADF resource bundle reference from VO source

I'm using JDeveloper version 11.1.1.7.0 for an ADF project. Whenever I edit a View Object that uses a resource bundle to provide labels via UI hints for things like input text fields and table column headers, the resource bundle reference at the end of the VO XML source gets automatically removed by JDeveloper. This means that every time I want to add a new attribute, change a binding, etc I must go to the History tab and restore the resource bundle reference before running my application. Otherwise, the labels are just displayed as the raw attribute names from the VO (e.g. "employeeName" instead of "Employee Name" from the resource bundle).
This is not just an issue for me, but for everyone on my team. At best, it's a constant annoyance. At worst, bugs get filed because labels are missing and inexperienced developers think they need to redefine every single label, which is a huge waste of time. I've searched on Oracle Support and can't find any patch for this. Google doesn't find anything useful. Does anyone else have this issue? Know what might be causing it and of a way to fix it?
ETA: Even if you've encountered this but don't have a solution, please post a comment stating this. Part of my question is whether this is an issue unique to the project I'm working on, or whether it's a common JDeveloper bug.
ETA: For the record, this is still a problem with version 12.1.3.
This has happened to us and this had caused regression issue in the past for us. We have had to redo the labels everytime we edit the view object. I guess this is a jdeveloper bug.

Ignore errors in database project

So, I have a database project in Visual Studio 2012. I'm trying to do a schema comparison against a DB in another environment, but I'm getting compile errors in my one sproc that are preventing me from doing the comparison. Not only do I wish to ignore all errors in the DB project, but even the errors it is throwing are not real errors and I cannot fix them. The one it gives me is that my variable is not declared. But it is, as a parameter for the sproc. I know the sproc works. I've used it many times in MSSMS. Is there a way to tell the DB project to ignore errors and just do the comparison?
Well, there must have been some sort of corruption in my database project. I finally got fed up and recreated it by first completely removing the project from the solution and source control. I no longer get these errors.
You can temporarily remove a project from the solution and effectively hide the errors by unloading the project (from the project context menu). Then, when you are ready to reincorporate it, just reload the project, and it's like nothing ever happened.

Building the project in Visual Studio makes references stop working?

I don't even know how to describe this. I have a WPF project that I've added some libraries to. Libraries I've used in many other projects before. I have the strange issue of, when typing out code, intellisense can fill in things from a library fine, but as soon as I do a build, VS acts like all of these things are undeclared. Import statements suddenly say that I'm trying to reference things that don't exist, etc. But then if I clean the build, all of the references come back fine.
I'm completely stumped, any thoughts?
I have seen this if you are targeting the client profile, but some of the DLLs require the full .net framework.
This can happen if you are using file based references to libraries ($ref) that have corresponding projects in the same solution as the one you are adding references to ($proj).
Visual Studio is unable to (reliably) understand the build order and builds the items out of sequence (the $proj is built before the $ref, but after the $ref's output has been cleaned).
If you have this situation, just change the references to project based references.
Similarly, make sure there are no build events that would alter or move files.
Also, VS will sometimes search for a reference and pick a file at a location that you do not expect. Highlight the reference and check its property page, and make sure its actually where you think it is.

Check CopyLocal property of all references post/during build in multi project solution (Multi Xap)

I have a Silverlight solution that has multiple silverlight projects (Views) that all compile to their own .Xap file.
There is one "master" project that handles the dynamic downloading of the Xap files, which works pretty well.
But now I need to make sure that all the references are set to CopyLocal=false in all the View Projects. Only the "master" project can have CopyLocal=true.
This means that the Xap files generated by the Views stay rather small.
What I would like to do is check post or during the build process to see if any of the View projects have a reference with CopyLocal=true.
What would be a smart way of doing this? Using an external tool in the Post Build event? Or perhaps an addin for Visual Studio ? Or creating a macro in Visual Studio for this?
I have looked at using .extmap with assembly caching, but since you have to specify the assemblies in that, this does not solve my problem. I just need to know if there is a reference with the wrong setting and report that. Fixing it is not the question, that will still be done manually. It's just the notification I need.
Solution has 35 projects now, so dont want to check them all by hand every time.
I found a question similar to this one, but it lists msbuild as a possible solution. I would like to know if there is a way to do this using "code" (be it prebuilt in a tool/addin or otherwise)
I have chosen to go the Addin path. I created an addin that listens to : BuildEvents.OnBuildBegin
Whenever that event fires I create a list of all projects in the current solution. Doing a bit of recursive searching since there are also Solution folders that make life in DTE world a bit harder.
Then I loop through all the projects and cast them to a VSProject so I can loop through all the references.
Anytime I come accross a reference that is wrong, I create an ErrorTask where I set the Document property to the full solution path of the reference. To do this I Build the path for the project this reference is in, all the way up to the root of the solution.
The ErrorTask is then sent to an ErrorListHelper class I created, that handles the ErrorTasks and also performs navigation.
If I'm done with all the projects and I found any errors, I cancel the current build and show the Error List window, where my ErrorListHelper holds all the Reference Errors I created.
Whenever I want to navigate to the Reference in question, I activate the Solution Explorer window and get the root of it using an UIHierarchy.
Then I walk the path from the root on down, step by step, using the UIHierarchy to get to the UIHierarchyItems and expand them. Until I get to the deepest level (the reference) and I Select that.
Since I only need it for a certain solution and within that solution for certain projects (.Views.* and .ViewModels.*) I also have some checking for those in place during buildup of the Error List.
It works like a charm, already found 12 "wrong" References in 35 projects where I tought all were well.
I am using a different path now to do this. I have a base class that I can use to write unit tests that have access to the DTE2 object. This way I dont need an addin. This also works for Silverlight projects since the test class does not actually need access to the Silverlight projects, just being in the solution is enough to be able to iterate through the projects and check the references.

Why does my DB project's .dbmdl file change even when I make no changes to the project?

I'm running into a small but weird annoyance that seems to be happening to other people, too (for example, check out the revision history of SEDE). I have a SQL Server 2008 database project in Visual Studio 2010 that works properly. When I go to commit/checkin to source control, I'm told that my DB project's .dbmdl file has changed, even when I've made no changes to the project!
I'm not sure if the changes are triggered by building my solution (which also includes an ASP.NET MVC application and a unit test project) or by simply opening the DB project, but this is getting kind of annoying and is creating clutter in source control.
Is it possible to stop these changes from occurring, or get rid of the .dbmdl file whatsoever?
If you delete the .dbml file, it is rebuilt without errors or warnings, so I think it's just a cache file for references, intellisense, etc. I'm going to exclude it from source control.
I believe Visual Studio serializes the dbmdl file every time the project is opened. The only possible work around would be to keep the project open.
See related question here. The .dbmdl file is unique per user (and some kind of cache, as said above) and so the right solution is indeed to exclude it from source control.

Resources