MOSS and Solution deployment: Your Features folder is missing some files


Have you done nice Feature (or set of Features) that you want to deploy using SharePoint Solution deployment? Great. Have you already deployed your newly created solution? Great. Are you missing files from your features folder: TEMPLATES\FEATURES\YourCompany.YourFeatureName ? You only have two xml files there (one is Feature.xml and the other one is probably Elements.xml)… and you should have extra files like MyPage.aspx or similar in your folder? If this is your case then keep on reading!

First phase of creating solution package is to create your solution manifest.xml that will tell everything that’s related to this solution package. Here is small example of solution with two features: site content types and eventhandlers.

<?xml version="1.0" encoding="utf-8" ?>
<solution xmlns="http://schemas.microsoft.com/sharepoint/"
  solutionid="477DB459-1EC9-4bcd-A56B-E7519F8F38F9">
  
<featuremanifests>
    <featuremanifest location="MyCompany.SiteContentTypes\feature.xml">
    <featuremanifest location="MyCompany.EventHandlers\feature.xml">
  </featuremanifests>
  <assemblies>
    <assembly location="MyCompany.EventHandlers.dll"
              deploymenttarget="GlobalAssemblyCache">
  </assemblies>
</solution>

Then you want to create .wsp file (using MakeCab.exe [it can be found in here if you don’t have one]) for your solution. And MakeCab needs .ddf file so that it knows what to put inside the package. Here is small example of .ddf file: 

.OPTION Explicit ; Generate errors
.Set CabinetNameTemplate="MyOwnPackage.wsp"
.Set DiskDirectoryTemplate=CDROM
.Set CompressionType=MSZIP
.Set UniqueFiles=Off
.Set Cabinet=On
.Set DiskDirectory1=Package
;
; \
;**************************************************
manifest.xml

.Set DestinationDir="MyCompany.EventHandlers"
"MyCompany.EventHandlers\Feature.xml"
"MyCompany.EventHandlers\EventHandlers.xml"

.Set DestinationDir="MyCompany.SiteContentTypes"
"MyCompany.SiteContentTypes\Feature.xml"
"MyCompany.SiteContentTypes\contenttype.xml"
"MyCompany.SiteContentTypes\Templates\MyDoc.docx"

Then you run: MakeCab.exe /f MyOwn.ddf
It gives you MyOwnPackage.wsp.

Second phase is to install the newly created file. You can use STSADM.EXE for that. Here’s an example:

@SET SPDIR="c:\program files\common files\microsoft shared\web server extensions\12"

%SPDIR%\bin\stsadm -o addsolution -filename MyOwnPackage.wsp
%SPDIR%\bin\stsadm -o deploysolution -name MyOwnPackage.wsp
                   -immediate -allowGacDeployment

So now you should have fully deployed solution in your SharePoint. Now if go to your feature folder (in this case: MyCompany.SiteContentTypes) you should have MyDoc.docx in there. But if it’s not there… you should check your features Feature.xml one more time. Let’s check out the example that fixes the problem:

<?xml version="1.0" encoding="utf-8" ?>
<feature id="5F1E0311-C2BD-40f6-A65E-06FA1047B5E0"
  title="MyCompany Site Contenttypes"
  xmlns="http://schemas.microsoft.com/sharepoint/
 
scope="Site"
  version="1.0.0.0"
  description="MyCompany Site Contenttypes">
  <elementmanifests>
    <elementmanifest location="contenttype.xml">
    <elementfile location="MyDoc.docx"> <!-- IMPORTANT! -->
  </elementmanifests>
</feature>

You should notice that there is elementfile that defines the location of MyDoc.docx. If you DON’T have this defined, ShapePoint will ignore that file even if it’s inside the .wsp file. So it just means, that even if you put a lot of stuff into your solution package you still need to define the files in your feature files.

I hope this makes sense to someone with this kind of problem.

Anyways… happy hacking!

J

Comments (6)

  1. mob says:

    Janne, thank you! Thats what I was missing!

  2. Manuel says:

    Thank you for your tip, you saved the day! My hero!

  3. Gilles says:

    cool stuff, thanks

  4. Ben Steinwand says:

    Thanks Janne!

    This is very helpful.

    Ben Steinwand

    Stanford >> SCCS

  5. Shobha says:

    This is really helpful.

    You have given the step by step way of installing a solution.

    🙂

  6. Nick QU. says:

    Hi, Blogger, nice to meet you. I wish to ask one question here. Thank you.

    I tried Sharepoint EventHandler ItemAdding, having registered via codes and testified its correct functionality.

    But when I changed to use feature.xml and stsadm command to register it, I met problem. The first time I successfully registered, but the next time I`m changing it and re-registered it, it didn`t change in .gif file and functionality as well. I guess something wrong in my way of deployment, This is my steps:

    1. iisreset

    2. stsadm.exe -o deactivatefeature -filename ../feature.xml -url .. -force

    3. stsadm.exe -o uninstallfeature -filename ../feature.xml -force

    4. iisreset

    5. stsadm.exe -o installfeature -filename ../feature.xml -force

    6. stsadm.exe -o activatefeature -filename ../feature.xml -url .. -force

    My Question:

    Where should we install feature to? if I want it to function on http://server/Test3/Nick5,

    should I refer to this url in the following commandings?

    BIN> stsadm.exe -o installfeature -filename "NickTest10feature.xml" -url http://Server/Test3/Nick5″>http://Server/Test3/Nick5"”>http://Server/Test3/Nick5″>http://Server/Test3/Nick5" target="_new" rel="nofollow">http://Server/Test3/Nick5″>http://Server/Test3/Nick5

    Or I`d better to register it firstly into "Site Collection Features" writing like the following way:

    BIN> stsadm.exe -o installfeature -filename "NickTest10feature.xml" -url http://Server

    or, Should I register it as a solution by sdk command?

    Thank you so much!

    Nick.

Skip to main content