【问题标题】:Why am I getting, "Error 392 Error occurred in deployment step 'Activate Features': Operation is not valid due to the current state of the object."为什么我会收到“部署步骤‘激活功能’中发生错误 392 错误:由于对象的当前状态,操作无效。”
【发布时间】:2015-10-12 17:44:28
【问题描述】:

Elements.xml 文件中缺少“模块”部分是否会导致“部署步骤‘激活功能’中发生错误 392 错误:由于对象的当前状态,操作无效。”?

突然间,我在尝试重建 Sharepoint Web 部件时遇到了该错误。 One thing I researched 表示可能 Elements.xml 有问题。很长一段时间以来我都没有改变任何东西,也没有明确地改变任何东西,我不认为,但现在就是这样:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Receivers ListTemplateId="104">
      <Receiver>
        <Name>PostTravelItemEventReceiverItemAdded</Name>
        <Type>ItemAdded</Type>
        <Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>
        <Class>PostTravelWizard.PostTravelItemEventReceiver.PostTravelItemEventReceiver</Class>
        <SequenceNumber>10000</SequenceNumber>
      </Receiver>
      <Receiver>
        <Name>PostTravelItemEventReceiverContextEvent</Name>
        <Type>ContextEvent</Type>
        <Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>
        <Class>PostTravelWizard.PostTravelItemEventReceiver.PostTravelItemEventReceiver</Class>
        <SequenceNumber>10000</SequenceNumber>
      </Receiver>

  </Receivers>
</Elements>

所以它现在只有对我添加的两个“事件接收器”处理程序的引用;我将此非工作项目的 Elements.xml 文件与我拥有的其他 Elements.xml 文件(来自有效的 Web 部件)进行了比较;其中一个看起来像这样:

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

...和另一个非常相似,像这样:

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

不同之处似乎在于,正在运行的 Web 应用在其 Elements.xml 文件中有一个“模块”部分

从上面的链接中也有另一个线索:

如果第 2 步没有解决您的错误,请检查您的部署目标是否设置为“WebApplication”。它需要改为“Global AssemblyCache”。

...在这里,不知何故,这个不工作的 WebPart 被设置为“WebApplication”,而其他的被设置为“GAC”)。但是,更改并没有帮助 - 我仍然收到与上面报告的相同的错误消息。

因此,如果缺少“模块”部分是问题所在,那显然是更早的(当它工作时)并且不知何故得到了 86 分(随着项目的“组件部署目标”属性的更改,显然)。为什么会/怎么会发生这种情况?

【问题讨论】:

    标签: sharepoint-2010 deployment-target


    【解决方案1】:

    添加(显然是后退)模块部分起到了作用。

    具体来说,我在“接收者”部分上方添加了以下内容:

    <Module Name="PostTravelWizardWebPart" List="113" Url="_catalogs/wp">
        <File Path="PostTravelWizardWebPart\PostTravelWizardWebPart.webpart" Url="PostTravelWizardWebPart.webpart" Type="GhostableInLibrary" >
          <Property Name="Group" Value="Financial Affairs Forms" />
        </File>
    </Module>
    

    ...现在部署成功了。

    (请注意,我也将项目的“Assembly Deployment Target”属性的值从“WebApplication”更改为“GlobalAssemblyCache”

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-08
      相关资源
      最近更新 更多