Sharepoint 2k7 - Custom WebPart not loading

拈花ヽ惹草 提交于 2020-01-03 05:16:49

问题


First off i am a big fat NOOB in regards to Sharepoint 2007 webpart development but i am working at it.

Now for the real problem, so i develop this webpart and follow the 'Loose' advise from various sites on how to setup the features.xml, .xml, manifest.xml, solution.ddf and solution.build files. Basically, i have a all-in-one solution where i build the webpart and then in post-build event compile all the source files into the WSP deployment package.

Problem i am having is that I can add the solution to the sharepoint site but when i go to Deploy it through CA-Operations-Solution management i get this great error:

Error as reported from Sharepoint

Failed to instantiate file "ChartPartWP.webpart" from module "ChartPartWP": Source path "ChartPartWP\ChartPartWP.webpart" not found.

When i looked at the file-system the folder ChartPart is present in TEMPLATE\FEATURES with the ChartPartWP.webpart and other support files.

What is not happening that i need to resolve.

Edit: 10/24/2011 @ 11:36PM

Solution.ddf

.OPTION EXPLICIT
.Set CabinetNameTemplate=ChartPartWP.wsp
.Set DiskDirectoryTemplate=CDROM
.Set DiskDirectory1=Package
.Set CompressionType=MSZIP
.Set UniqueFiles="ON"
.Set Cabinet=On
.Set SourceDir="\\<fileserver>\common share\Software_Development\MPT\Sharepoint2007\ChartPart\"

Manifest.xml manifest.xml

; binary
bin\release\TCBOE.ChartPart.dll TCBOE.ChartPart.dll

; feature files
TEMPLATE\FEATURES\ChartPartWP\ChartPartWP.xml ChartPartWP\ChartPartWP.xml
TEMPLATE\FEATURES\ChartPartWP\feature.xml ChartPartWP\Feature.xml

; web part files
TEMPLATE\FEATURES\ChartPartWP\ChartPartWP.webpart ChartPartWP\ChartPartWP.webpart
TEMPLATE\FEATURES\ChartPartWP\LockedChartPartWP.webpart ChartPartWP\LockedChartPartWP.webpart

manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<Solution xmlns="http://schemas.microsoft.com/sharepoint/"
 SolutionId="{0C32EA7F-78C2-4814-A4C9-88256E49E371}">
  <FeatureManifests>
    <FeatureManifest Location="ChartPartWP\feature.xml" />
  </FeatureManifests>
  <Assemblies>
    <Assembly Location="TCBOE.ChartPart.dll"
              DeploymentTarget="GlobalAssemblyCache" />
  </Assemblies>
</Solution>

ChartPartWP.xml

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Module Name="ChartPartWP" 
              List="113" Url="_catalogs/wp" 
              Path="ChartPartWP" 
              RootWebOnly="True">
        <File Url="ChartPartWP.webpart" Type="GhostableInLibrary">
            <Property Name="Group" Value="ChartParts" />
        </File>
        <File Url="LockedChartPartWP.webpart" Type="GhostableInLibrary">
            <Property Name="Group" Value="ChartParts" />
        </File>
    </Module>
</Elements>

feature.xml

<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/"
  Id="47D62F5E-B0E0-4f93-BCD1-081CA794527C" Version="3.5.1.0"
  Title="TCBOE ChartPart"
  Description="Provides a Chart Web object to be used in Sharepoint 2007."
  AutoActivateInCentralAdmin="TRUE"
  Scope="Site">
    <ElementManifests>
        <ElementManifest Location="ChartPartWP.xml" />
        <ElementFile Location="ChartPartWP.webpart" />
        <ElementFile Location="LockedChartPartWP.webpart"/>
    </ElementManifests>
</Feature>

Would there be any receivers/handlers i need make are implemented for the installation to take hold? I didnt read anything about it but read something about a FeatureReceiver for a purpose, but cant remember for the life-of-it, why you need the FeatureReceiver (SPFeatureReceiver)


回答1:


SPFeatureDefinition.AutoActivateInCentralAdmin Property

Gets a value that specifies whether the Feature is activated on the central administrative Web site, site collection, or Web application upon installation.

Without testing your entire samples, using this property sounds off to me. Try removing that.

update: you should post your .webpart also (it is a xml).

Try these configs: Feature.xml

<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/" Id="47D62F5E-B0E0-4f93-BCD1-081CA794527C" Version="3.5.1.0" Title="TCBOE ChartPart" Description="Provides a Chart Web object to be used in Sharepoint 2007." Scope="Site">
    <ElementManifests>
        <ElementManifest Location="ChartPartWP\ChartPartWP.xml" />
        <ElementFile Location="ChartPartWP\ChartPartWP.webpart" />
        <ElementFile Location="ChartPartWP\LockedChartPartWP.webpart"/>
    </ElementManifests>
</Feature>

webpart.xml

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Module Name="ChartPartWP" List="113" Url="_catalogs/wp">
        <File Path="ChartPartWP.webpart" Url="ChartPartWP.webpart" Type="GhostableInLibrary">
            <Property Name="Group" Value="ChartParts" />
        </File>
        <File Path="ChartPartWP.webpart" Url="LockedChartPartWP.webpart" Type="GhostableInLibrary">
            <Property Name="Group" Value="ChartParts" />
        </File>
    </Module>
</Elements>

If nothing works, I would recommend installing and using the VSeWSS 1.3 from Microsoft, create a new webpart, hit F5, test it. If you can see it in the "Add Web Parts" dialog, move your files over. This is the closest you will get to the SharePoint 2010 experience (which is terribly improved).

Having to fiddle with these files, even more to a beginner, should not be your burden.



来源:https://stackoverflow.com/questions/7878798/sharepoint-2k7-custom-webpart-not-loading

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!