Error and Fix
When
I attempt to activate a solution in SharePoint 2010 I get an error that reads
“The ‘DisplayName’ attribute is not declared.” This error occurs when I save a
site as a template and in the site I have a site column of type choice. For
some reason when you add a column and make its type MultiChoice the wsp writer
adds the attribute DisplayName.
<CHOICES>
<CHOICE DisplayName="one">one</CHOICE>
<CHOICE DisplayName="two">two</CHOICE>
<CHOICE DisplayName="three">three</CHOICE>
</CHOICES>
The
DisplayName attribute is not part of the wss.xsd so when you try to activate
the solution you receive an error.
I
opened the wss.xsd from the system folder “C:\Program Files\Common
Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\XML\wss.xsd” and made
the following changes.
<!-- added by Marcellus Duffy to fix the error -->
<xs:complexType name="CHOICEDEF" mixed="true">
<xs:attribute name="DisplayName" type="xs:string"/>
</xs:complexType>
<!-- end addition -->
<!-- modified by Marcellus Duffy-->
<xs:complexType name="CHOICEDEFINITIONS" mixed="true">
<xs:sequence>
<xs:element name="CHOICE"
type="CHOICEDEF" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<!-- end modification -->
After
saving these changes and doing an iisreset I was able to active the solutions
with choice columns that were written by the save as template wizard.