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

Published 28 February 07 08:47 PM | jannemattila 

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

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# mob said on May 28, 2007 10:19 PM:

Janne, thank you! Thats what I was missing!

# Manuel said on July 19, 2007 4:49 AM:

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

# Gilles said on July 26, 2007 4:41 AM:

cool stuff, thanks

# Ben Steinwand said on November 9, 2007 1:55 PM:

Thanks Janne!

This is very helpful.

Ben Steinwand

Stanford >> SCCS

# Shobha said on June 9, 2008 11:57 AM:

This is really helpful.

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

:)

# Nick QU. said on July 7, 2008 11:31 PM:

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 "NickTest10\feature.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 "NickTest10\feature.xml" -url http://Server

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

Thank you so much!

Nick.

Leave a Comment

(required) 
(optional)
(required) 

  
Enter Code Here: Required

Search

This Blog

Syndication

Page view tracker