Sharepoint 2k7 - 自定义 WebPart 未加载 [英] Sharepoint 2k7 - Custom WebPart not loading

查看:51
本文介绍了Sharepoint 2k7 - 自定义 WebPart 未加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我在 Sharepoint 2007 webpart 开发方面是个大胖子,但我正在努力.

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

现在是真正的问题,所以我开发了这个 webpart 并遵循来自不同站点的关于如何设置 features.xml、.xml、manifest.xml、solution.ddf 和 solution.build 文件的松散"建议.基本上,我有一个多合一的解决方案,我构建 webpart,然后在构建后事件中将所有源文件编译到 WSP 部署包中.

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.

我遇到的问题是我可以将解决方案添加到 sharepoint 站点,但是当我通过 CA-Operations-Solution management 去部署它时,我遇到了这个大错误:

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:

无法从模块ChartPartWP"实例化文件ChartPartWP.webpart":未找到源路径ChartPartWP\ChartPartWP.webpart".

Error as reported from Sharepoint

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

当我查看文件系统时,文件夹 ChartPart 存在于 TEMPLATE\FEATURES 中,其中包含 ChartPartWP.webpart 和其他支持文件.

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.

10/24/2011 @ 11:36PM

10/24/2011 @ 11:36PM

.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>

是否有任何我需要的接收器/处理程序被实现以安装?我没有阅读任何关于它的内容,但出于某种目的阅读了有关 FeatureReceiver 的一些内容,但终生不记得,为什么需要 FeatureReceiver (SPFeatureReceiver)

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)

推荐答案

SPFeatureDefinition.AutoActivateInCentralAdmin 属性

获取一个值,该值指定是否在安装时在中央管理网站、网站集或 Web 应用程序上激活该功能.

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.

更新:您也应该发布您的 .webpart(它是一个 xml).

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

试试这些配置:Feature.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

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>

如果没有任何效果,我建议安装和使用 VSeWSS 1.3 从Microsoft,创建一个新的 webpart,按 F5,测试它.如果您可以在添加 Web 部件"对话框中看到它,请将您的文件移过去.这是您将获得的最接近 SharePoint 2010 体验的体验(它得到了极大的改进).

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.

这篇关于Sharepoint 2k7 - 自定义 WebPart 未加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆