[RESOLVED] [2005] how to disable 'not CLS-compliant' warnings?
I use VS 2005 Professional and get a long list (usually above the maximum of 102) of warnings because my code (including my DLL's) uses unsigned integers a lot, be it as the type of parameters of public methods, as the type of public properties, or as the underlying type of public enumerations.
Unsigned integers are supported by VB.NET since VS 2005 and were supported by C# even before, but they are not supported by the CLS. I am perfectly aware of that, but want to use unsigned integers nevertheless, so all those non-compliance warnings distract from the warnings and errors I really want to focus on.
Sample warnings:
1 Type of parameter 'uintIdArg' is not CLS-compliant.
2 'RpcMainForm' is not CLS-compliant because it derives from 'MyMainFormBase', which is not CLS-compliant.
3 Underlying type 'UInt32' of Enum is not CLS-compliant.
Question:
Is there a way to disable in the VS2005 IDE only those CLS-non-compliance warnings without simultaneously disabling all other types of warnings?
And if not: Will it at least get better with VS2008? :-)
Re: [2005] how to disable 'not CLS-compliant' warnings?
No, you are only able to disable warnings for one error all throughout your project. In the Project Properties > Code Analysis section, expand your warning messages and uncheck the one you want but it will apply to your entire project.
Or are you talking about configuration warnings? project Properties > Compile section > Condition listings.
Re: [2005] how to disable 'not CLS-compliant' warnings?
First off, thanks for your quick reply and for trying to help!
Quote:
Originally Posted by RobDog888
No, you are only able to disable warnings for one error all throughout your project.
I'd actually like to deactivate warnings for an entire category (such as "... is not CLS-compliant"), not just for a single instance of an error, and yes, throughout my project.
Quote:
Originally Posted by RobDog888
In the Project Properties > Code Analysis section, expand your warning messages and uncheck the one you want but it will apply to your entire project.
My VS2005 doesn't give me a Code Analysis section in the Project Properties. I get "Application", "Compile", "Debug", "References", "Resources", "Settings", "Signing", "Security" and "Publish" in the tab control on the left.
The documentation mentions that "Code Analysis" section, but it says "Visual Studio Team System" in small print in the top line, so this may be a Team System-specific feature that VS2005 Professional users don't get?
If it is Team System-specific, I would actually upgrade just for that reason, but before I spend the $ I'd like to know for sure that "not CLS-compliant" warnings are one of the categories listed in the "Code Analysis" section of the Project Properties.
1 Attachment(s)
Re: [2005] how to disable 'not CLS-compliant' warnings?
Sorry, yes, I am running Team Suite and trust me you dont want to buy it. Its several times the price of VS Pro.
Ok, in the Compile properties do you have the warnings list?
I have the Code Analysis section which shows this as I think its what you want. You can only change it from Warning to Error or uncheck it to disable CA checking for just that one type publically across your project.
Re: [2005] how to disable 'not CLS-compliant' warnings?
Quote:
Originally Posted by RobDog888
Sorry, yes, I am running Team Suite and trust me you dont want to buy it. Its several times the price of VS Pro.
I may have to live with that cost even though, as a solitary developer, I don't really need team-related functionality...
Quote:
Originally Posted by RobDog888
Ok, in the Compile properties do you have the warnings list?
I have a Compile section in the Project Properties and it does list some "Conditions" for which I can choose whether to treat them as "Error", "Warning" or "None":
- Implicit conversion
- Late binding; all could fail at run time
- Implicit type; object assumed
- Use of variable prior to assignment
- Function/Operator without return value
- Unused local variable
- Instance variable accesses shared member
- Recursive operator or property access
- Duplicate or overlapping catch blocks
Other than that, I can just choose to "Disable all warnings" or "Treat all warnings as errors" and have another choice related to the generation of an XML documentation file.
So it seems VS2005 Professional doesn't allow me to get rid specifically of all those "not CLS-compliant" warnings...
Quote:
Originally Posted by RobDog888
I have the Code Analysis section which shows this as I think its what you want. You can only change it from Warning to Error or uncheck it to disable CA checking for just that one type publically across your project.
That's right, it is what I want. Of course, I'd rather find a solution with the Professional edition, but if I have no choice, I'll go for the Team Edition...
Re: [2005] how to disable 'not CLS-compliant' warnings?
You may want to verify that there is not another version that includes the Code Analysis feature before you buy but isnt that allot to spend just to dismiss the warnings?
I would see too if you can get an upgrade version as you stated you have 2005 pro full version I assume.
I think it may be called "Code Profiling" but a call to MS should be able to confirm this and this only appears in the VSTS version:
http://msdn2.microsoft.com/en-us/vstudio/aa700921.aspx
Re: [2005] how to disable 'not CLS-compliant' warnings?
Oh, not sure if this will work for you but MS just published its VS 2008 Beta 2 and it does come with a "Go Live" license option (purchase option) which may be cheaper.
They do have a VSTS 2008 version too :D
See my thread located here -->http://vbforums.com/showthread.php?t=481010
Re: [2005] how to disable 'not CLS-compliant' warnings?
I know it's a lot of money, but in terms of productivity, other warning categories (such as "unused local variable") are very useful. Disabling all warnings of all categories is not an option; the problem is that the list at the bottom is useless when all those CLS-non-compliance warnings "spam" the list, but I still get some value out of those warnings when I look at a specific code segment.
What I may consider is continuing my project with the Professional edition for some more time and maybe there'll be a less expensive solution with VS 2008 indeed...
Re: [2005] how to disable 'not CLS-compliant' warnings?
I would disable the warnings manually. I did it on occasion based on some info found on the Internet. It was some months ago so I could be missing details. First you need the internal warning's ID. It can be seen in the Output window (View -> other windows -> output).
Then go to Build -> Build Solution. In the output window search for the error code, for example BC4535. You need only the numeric part, in this case 4535.
Close VS and open the projectname.vbproj file with a text editor. Look for the <NoWarn> tag and add that '4535' there. No new lines or empty spaces! It should look like this <NoWarn>4535</NoWarn>.
There are 2 such tags, for the debug and the release versions respectively. Each one must be edited.
Re: [2005] how to disable 'not CLS-compliant' warnings?
Good tip Half. It will save VbBrilDisg thousands of $'s. :thumb:
Re: [2005] how to disable 'not CLS-compliant' warnings?
Quote:
Originally Posted by Half
I would disable the warnings manually. I did it on occasion based on some info found on the Internet.
Thank you so much! This is exactly what I was hoping for, a workaround that solves the problem with the Professional edition and this one does.
Quote:
Originally Posted by Half
No new lines or empty spaces! It should look like this <NoWarn>4535</NoWarn>.
Well, I gave it a try and just added a NoWarn line in the Properties part of that XML file, and it worked! I added error codes 40025,40026,40027,40028.
Quote:
Originally Posted by Half
There are 2 such tags, for the debug and the release versions respectively. Each one must be edited.
Actually that one line already did the job.
Thanks again, I was really thinking quite seriously about the Team edition because that list of warnings became almost unusable, and I needed the other (non-CLS-compliance-related) warnings to be fully productive. Now I've got a solution.
Re: [2005] how to disable 'not CLS-compliant' warnings?
Cool, glad its all settled and working for you now.
Since your issue has been solved it would be helpful to other members to know its done by having you Resolve your thread by clicking the Thread Tools menu > Mark Thread as Resolved. ;)