In the ShapeAppSamples for VSTA v 1,
Visual Basic add-ins build with a warning that "'AppAddIn' is not
CLS-compliant becuase it derives from 'Application', which is not
CLS-compliant."; however, for VSTA v 2, the warning is gone.
What does it mean?
What does it do?
Why is it there?
What is the answer to life, the universe, and everything?
How do you make it go away?
I don't know, I don't know, I don't know, 42, set the CLSCompliant attribute to
false.
Justification- between VSTA v 1 and v 2 changes were made to ProjectGen so that projects
created with project templates created by ProjectGen by default have this
attribute set to false.
You can set this attribute at many different levels. ProjectGen in VSTA v 2, by
default, sets the entry point's partial class in the MainForm.Designer.vb
CLSCompliantAttribute to false. In the sample add-ins included with the
ShapeApp samples, both the assembly level and designer partial class level
attributes are set to false.
If you would like to get rid of the warning for a VSTA v 1 VB add-in, follow
these steps:
1) Show all the hidden files- with the
project open, in the ProjectExplorer, select the "ShowAll" icon
located between the "Properties" and "Refresh" icons.
2) Set the assembly level attribute to false- in the ProjectExplorer,
expand the node next to "My Project". Directly under "My
Project" the file AssemblyInfo.vb should be available. In this file,
locate the attribute and change it from true to false.
<Assembly: CLSCompliant(True)> (change
to) <Assembly: CLSCompliant(False)>
3) Set hte class level
attribute to false- in the Project Explorer, expand the node next to
AppAddIn.vb (or whatever the main code file is called), then expand the node
below AppAddIn.Designer.xml. Beneath this node you will find
AppAddIn.Designer.vb with the Partial Class definition. Change the
attribute in this class to include CLSCompliant set to false.
<Microsoft.VisualStudio.Tools.Applications.Contract.EntryPointAttribute(0)>
(change to)
<Microsoft.VisualStudio.Tools.Applications.Contract.EntryPointAttribute(0),
Global.System.CLSCompliant(False)>
It is sufficient to do either step 2
or step 3, but if you like to go overboard go ahead and do both. If you would like to change a template to
ensure the warning does not show up, change the AssemblyInfo.vb file and follow
the directions on how to update a project template. You can change and include the
AppAddInDesigner.vb file, but it is more difficult because by default this file
is created when the project is created, not included in the template (write to vstasupport@summsoft.com
for directions on this).