Directory

I am trying to create a custom list feature, what I did is created feature and then i build a solution out of it using this tutorial

Creating a Solution file for Feature

when it creates a .wsp file for the feature, it includes, manifest, and then a folder containing feature.xml, element.xml and then a sub folder containing schema.xml.

Now when I add and deploy the solution using STSADM commands, what it does is creates a folder in 12 hive and only copies feature.xml and elements.xml in it, not the schema.xml (In result when i try to create the list using this feature, it gives me ERROR: Exception from HRESULT: 0x81070201 which means its not finding the schema.xml)

Now if i copy the files of this feature and just change the names and the GUID ids, and copy the folder in 12Hive features manually & using "Install feature" instead of adding and deploying the feature, it works perfectly.

Now the problem comes somewhere when it deploys the .wsp file i cant blame the tutorial as when it creates the .wsp file it contains all the necessary files required.

If i post the code this question will be too long, so ask me if you need anything,

Cheers

Feature.xml

<?xml  version="1.0" encoding="utf-8"?>
<Feature 
Title="YourFeature" 
Description="YourFeature" 
Id="GUID" 
Scope="Site" 
Version="1.0.0.0" 
Hidden="FALSE"
DefaultResourceFile="core"
xmlns="http://schemas.microsoft.com/sharepoint/">
  <ElementManifests>
    <ElementManifest Location="elements.xml" />
  </ElementManifests>
</Feature>

Manifest

<?xml version="1.0" encoding="utf-8"?>
<Solution xmlns="http://schemas.microsoft.com/sharepoint/" 
          SolutionId="GUID" >
  <FeatureManifests>
    <FeatureManifest Location="YourFeature\Feature.xml"/>
  </FeatureManifests>
</Solution>

elements.xml

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <ListTemplate Name="YourFeature"
                DisplayName="YourFeature"
                Description="YourFeature"
                Type="11006"
                BaseType="0"
                OnQuickLaunch="FALSE"
                SecurityBits="11" />
</Elements>

wsp.ddf

.OPTION Explicit
.Set DiskDirectory1="..\YourFeature"
.Set CabinetNameTemplate="YourFeature.wsp"

manifest.xml

; These directory names (DestinationDir) are used for the folders creation under 12\TEMPLATE\Features

.Set DestinationDir="YourFeature"
elements.xml

.Set DestinationDir="YourFeature\YourFeature"
YourFeature\schema.xml

.Set DestinationDir="YourFeature"
Feature.xml

a bit of schema file code

<?xml version="1.0" encoding="utf-8"?>
<List xmlns:ows="Microsoft SharePoint"  Name="YourFeature" Title="YourFeature" Description="" Direction="" Url="" BaseType="0" xmlns="http://schemas.microsoft.com/sharepoint/">
    <MetaData>  
        <Fields>....... (too long to be posted)
有帮助吗?

解决方案

You are missing the ElementFile element. From what you've described, your feature.xml should look something like this:

<?xml  version="1.0" encoding="utf-8"?>
<Feature 
Title="YourFeature" 
Description="YourFeature" 
Id="GUID" 
Scope="Site" 
Version="1.0.0.0" 
Hidden="FALSE"
DefaultResourceFile="core"
xmlns="http://schemas.microsoft.com/sharepoint/">
  <ElementManifests>
    <ElementManifest Location="elements.xml" />
    <ElementFile Location="YourFeature\schema.xml" />
  </ElementManifests>
</Feature>

The schema.xml should be in a folder named YourFeature. Also, the folder that contains schema.xml must be the same as the value of the Name attribute in your elements.xml.

其他提示

I would check your ddf file. Here is the preview from one of my projects

;.OPTION Explicit
.Set CabinetNameTemplate="Test.wsp"
.Set DiskDirectoryTemplate="..\TargetFolderForWsp(bin)"
.Set CompressionType=MSZIP
.Set UniqueFiles=Off
.Set Cabinet=On

;*******************************

manifest.xml
%BuildPath%\Test.dll Test.dll
.Set DestinationDir="FeatureName"
12\TEMPLATE\FEATURES\FeatureName\feature.xml feature.xml
12\TEMPLATE\FEATURES\FeatureName\SiteColumns.xml SiteColumns.xml
12\TEMPLATE\FEATURES\FeatureName\ContentTypes.xml ContentTypes.xml
12\TEMPLATE\FEATURES\FeatureName\ListTemplateName\ListDefinition.xml ListTemplateName\ListDefinition.xml
12\TEMPLATE\FEATURES\FeatureName\ListTemplateName\Schema.xml ListTemplateName\Schema.xml
12\TEMPLATE\FEATURES\FeatureName\ListTemplateName\AllItems.aspx ListTemplateName\AllItems.aspx
12\TEMPLATE\FEATURES\FeatureName\ListTemplateName\DispForm.aspx ListTemplateName\DispForm.aspx
12\TEMPLATE\FEATURES\FeatureName\ListTemplateName\EditForm.aspx ListTemplateName\EditForm.aspx
12\TEMPLATE\FEATURES\FeatureName\ListTemplateName\NewForm.aspx ListTemplateName\NewForm.aspx

The first path is path to file in project (Replace with you file path) The second path is the package location reltaive to the DestinationDir specified above

许可以下: CC-BY-SA归因
scroll top