我创建了一个vs解决方案:
它编译没有任何问题。 该功能打包了所有4件事,IsHidden设置为true,因为它只能通过powershell启用。
但是当我启用它时,我在日志中得到以下例外
Enable-SPFeature : Key cannot be null.
Parameter name: key
At line:28 char:17
+ Enable-SPFeature <<<< "SlnOneSkyTeamsCustomization_FeatureExternalCIRCASites" -Url http://ost-dev1.ciredev1.local/
+ CategoryInfo : InvalidData: (Microsoft.Share...etEnableFeature:SPCmdletEnableFeature) [Enable-SPFeature], ArgumentNullException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletEnableFeature
我安装了这样的功能:
# Adds and Installs the SP Solution
Add-SPSolution -LiteralPath "D:\Sources\s\27022012\SlnOneSkyTeamsCustomization\SlnOneSkyTeamsCustomization\bin\Debug\SlnOneSkyTeamsCustomization.wsp"
Install-SPSolution –Identity SlnOneSkyTeamsCustomization.wsp -GACDeployment -Force
# Install-SPFeature use it only after installing or upgrading the solution
Install-SPFeature "SlnOneSkyTeamsCustomization_FeatureExternalCIRCASites" -force
Enable-SPFeature "SlnOneSkyTeamsCustomization_FeatureExternalCIRCASites" -Url http://x/
只有最后一行是抛出异常的行。
在uls日志上我也看到了: 键不能为空。参数名称:key
功能激活:抛出异常,尝试回滚。功能'SlnOneSkyTeamsCustomization_FeatureExternalCIRCASites'(ID:'4abb1043-ac29-4897-8ebc-7e01b897e6ed')。异常:System.ArgumentNullException:键不能为null。参数名:Microsoft.SharePoint.Administration.SPElementDefinitionCollection.ProvisionFieldsAndContentTypes(SPFeaturePropertyCollection props,SPSite site,SPWeb web,Boolean fForce)上的密钥,位于Microsoft.SharePoint.Administration.SPElementDefinitionCollection.ProvisionElements(SPFeaturePropertyCollection props,SPWebApplication webapp,SPSite site,SPWeb web, Microsoft.SharePoint.SPFeature.Activate(SPSite siteParent,SPWeb webParent,SPFeaturePropertyCollection props,Boolean fForce)中的布尔fForce)
错误类别:InvalidData目标对象Microsoft.SharePoint.PowerShell.SPCmdletEnableFeature Details NULL建议操作NULL
我可以在下面显示所有文件的代码。
答案 0 :(得分:1)
查看异常的堆栈跟踪我可以假设您在字段内容或内容类型中具有无效的XML定义。 Perphaps你缺少一些强制属性。你能发布特征元素的定义吗?