zoukankan      html  css  js  c++  java
  • Error occurred in deployment step ‘Activate Features’: Operation is not valid due to the current state of the object

    用vs2010新建一个事件接收器,部署竟然报如下错误:

    Error occurred in deployment step 'Activate Features': Operation is not valid due to the current state of the object.

    google了一下遇到这个错误的人还蛮多,不过都解决不了我的问题,这里先把收集的两个列出了,然后介绍我的解决方案。

    1.导致的原因是新建好项目后,手动修改了项目命名空间,导致Elements.xml文件中的Class节点出问题。解决方法:修改一下对应的Class节点内容即可。

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
       <Receivers ListTemplateId="101">
          <Receiver>
             <Name>
    EventReceiver1EmailReceived</Name>
             <Type>EmailReceived</Type>
             <Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>
             <Class>YourProjectNameHere.EventReceiver1.EventReceiver1</Class>
             <SequenceNumber>10000</SequenceNumber>
          </Receiver>
       </Receivers>
    </Elements>
    2.这位仁兄解决方法更简单,他说,当使用vs2010部署feature遇到这个错误,一律杀掉进程:vssphost4.exe

    下面是我的解决方案:

    其实我的问题就更简单了。原因就是我在类里声明了全局变量。比如我ItemAdding和ItemDeleteing两方法里都需要ErrorMessage信息,为了方便,所以我就声明一个全局变量。谁知道竟然报错了。解决方法,就是删除全局变量就行了,在需要的地方声明局部变量代替。

  • 相关阅读:
    Doing Homework 简单dp&&状态压缩
    嫖裤子序列
    王宁宁宁
    友军寻路法
    Viviani
    ccf 201909-3
    ccf 201909-5
    链式前向星
    ccf-201909-04
    ccf -201909-2
  • 原文地址:https://www.cnblogs.com/sygwin/p/2248996.html
Copyright © 2011-2022 走看看