Must I have a feature icon?

Oct 21, 2008 at 4:34 PM
Hi,

The samples include the African pith helmet as the feature icon.  Must I always include an icon, or is there a way to avoid that and just have SharePoint use the default icon?

Thanks.
Nov 25, 2008 at 9:38 AM
Edited Nov 27, 2008 at 12:55 PM
You don't have to use the African Pitch picture. You just remove "ImageUrl="iconTest\AfricanPith32.gif"" from the feature.xml file and the feature will use the default image. Or even better, you could replace the image with one of your own or one from the IMAGES folder. But there seems there is an error with the way STSDEV edits the manifest.xml, because if you remove the African Pitch picture from the project you get an error. So you need a dummy image in the project if you want it to compile.

Update: It is really a bug in the code for the stsdev project. In the project there is a ManifestBuilder.cs file that has all the code that handles the building of the Manifest.xml. The problem is that when the XML is build it checks to see if there is a TEMPLATE folder, and if there is a TEMPLATE folder it makes the start tag <TemplateFiles>, then it parses to find files in the folders... But it excludes all files contained under the folder FEATURES. Since there is only files under that folder when you have removed the picture it doesn't have any files that are to be written between the start and end tag for the <TemplateFiles> part of the XML, and it just closes the start tag with a />. That way you get a <TemplateFiles /> tag in the XML, and that isn't allowed in the manifest.xml.

      if (Directory.Exists(Globals.TemplatesFolder)) {
        // write TEMPLATE Files
        writer.WriteComment("TEMPLATE files");
        writer.WriteStartElement("TemplateFiles");
        WriteTemplateFiles(writer);
        writer.WriteEndElement(); // </TemplateFiles>
      }
    static void WriteTemplateFiles(XmlWriter writer) {
      EnumerateTemplateDirectory(writer, Globals.TemplatesFolder);
    }
    static void EnumerateTemplateDirectory(XmlWriter writer, string path) {

      foreach (string file in Directory.GetFiles(path)) {
        if (!file.Contains("FEATURES")) {
          writer.WriteStartElement("TemplateFile");
          writer.WriteAttributeString("Location", file.Substring((Globals.TemplatesFolder + @"\").Length));
          writer.WriteEndElement();
        }
      }

      foreach (string folder in Directory.GetDirectories(path)) {
        if (!folder.Contains("FEATURES")) {
          EnumerateTemplateDirectory(writer, folder);
        }
      }
    }