Failed to instantiate file "myComms.webpart" from module "WebPartPopulation": Source path "myComms.webpart" not found.

  • Failed to instantiate file "myComms.webpart" from module "WebPartPopulation": Source path "myComms.webpart" not found. Patrick

    I have a webpart i build using WSpBuilder and it works OK. When i use Deploy from Visual Studio it installs the WSP sharepoint and add the webpart to the webpart gallery. But it seems the feature does activate the webpart but i also want to remove it when deactivating it.(So i know i need to add something to the FeatureDeactivating

    So i created a Feature With Reciever template and added it to the project.Which created a folder FeatureWithReceiver with the element and feature xml files and also a FeatureCode folder with FeatureWithReceiver.cs

     public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
            SPSite site = null;
            site = properties.Feature.Parent as SPSite;
            using (SPWeb web = site.RootWeb)
              SPList list = web.Lists["Web Part Gallery"];
              // go through the items in reverse
              //for (int i = list.ItemCount – 1; i >= 0; i–)
              for(int i=list.ItemCount-1; i >=0; i--)
                // format name to look like a feature name
                string webpartName = list.Items[i].Name;
                webpartName = webpartName.Substring(0, webpartName.IndexOf("."));
                // delete web parts that have been added
                if (webpartName == "myStoreComms")
            if (site != null)

    In the feature.xml i have this below

    <?xml version="1.0" encoding="utf-8"?>
    <Feature Id="5d910db3-5adf-4f8e-a102-05d5a1653c59"
         Description="Description for FeatureWithReceiver"
         ReceiverAssembly="MWO.SharePoint, Version=, Culture=neutral, PublicKeyToken=c9faae97dc801bd2"
      <ElementManifest Location="elements.xml"/>


    <?xml version="1.0" encoding="utf-8" ?>
    <Elements xmlns="">
        <Module Name="WebPartPopulation" Url="_catalogs/wp" RootWebOnly="TRUE">
            <File Url="myStoreComms.webpart" Type="Ghostable">
                <Property Name="Group" Value="MyGroup"></Property>
                <Property Name="QuickAddGroups" Value="MyGroup" />

    But when i go to the site features i can see the feature but when i activate it it does puts the webpart in the gallery but when i deactivate it it doesn't remove it but i get error:

    Failed to instantiate file "myStoreComms.webpart" from module "WebPartPopulation": Source path "myStoreComms.webpart" not found.

    Any ideas.. .what could be wrong and thanks in advance

  • You are disposing the SPSite referenced by properties.Feature.Parent

    Since you did not instantiate this SPSite, you should not dispose it. Change this first.

    If that didn't fix it then attach the debugger. Does it throw an exception within your block of code? If so, on what line? It could be that the exception is being thrown after your code executes because you changed some state in your code (e.g. you disposed an SPSite which SharePoint needs to complete Feature deactivation) which affects further execution.

2007 development
Related questions and answers
  • (I have also asked this question on Stack Overflow) I have a SharePoint feature I'm using to add some custom aspx files to the Pages Library. When I activate the feature, I can visit the pages in-browser and they are visible in SPDesigner, but when I "View All Site Content" they are not there. Why is this the case? The Feature's Elements File: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;Elements Id="9e85eb79-6d8d-4ff3-b0d4-64d55c3bb577" xmlns=""&gt; &lt;Module Name="Pages" Url="Pages"&gt; &lt;File Path="Example.aspx" Url

  • ()); } UPDATE: Based on feedback from Wictor, I tried the following: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;webParts> &lt;webPart xmlns=""&gt; &lt...;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;"; //webPartXml = webPartXml + "&lt;WebPart xmlns:xsi=\"\" xmlns:xsd=\"\" xmlns.../WebPart/v2/ContentEditor\" /&gt; &lt;PartStorage xmlns=\"\" /&gt;&lt;/WebPart>"; var webPartXml = "&lt;?xml version=\"1.0\" encoding=\"utf-8

  • ="" &gt; &lt;Module Name="Home" List="113" Url="_catalogs/wp"&gt; &lt;File Path="Home\Home.webpart" Url="Home.webpart" Type="GhostableInLibrary" &gt; &lt;Property Name="Group" Value="Custom" /&gt; &lt;/File> &lt;/Module> &lt;/Elements> IdeaEditor elements.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;Elements xmlns="http... xmlns="" &gt; &lt;Module Name="IdeaGrid" List="113" Url="_catalogs/wp"&gt; &lt;File Path="IdeaGrid\IdeaGrid.webpart" Url="IdeaGrid.webpart" Type

  • " /&gt; &lt;/ElementManifests> &lt;/Feature> elements.xml &lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;Elements xmlns=""&gt; &lt;/Elements>... in a WebPart zone. When doing this, I get an error message : Tooltips: List View Web Part could not be added, list may be hidden. What's wrong with the list? feature.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;Feature Id="70d49f3d-233a-482d-97e3-dcec2c236171" Title="MyApp - Tooltips" Description="Creates a Tooltips list which can be used for mouse-over texts

  • someone else has cracked this nut. &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;Elements xmlns=""&gt; &lt;Module Name="Pages"&gt; &lt;File Path="" Url="default.aspx"&gt; &lt;AllUsersWebPart WebPartZoneID="Left" WebPartOrder="1"&gt; &lt;![CDATA[ &lt;WebPart xmlns="" xmlns:iwp="http... Module: I think this is the most likely path forward, however it seems to always want to provision a file to the site. For example, if I want to add a web part to the home page (default.aspx

  • Hello I really need help with this... , I am using Sharepoint 2007. I have the 'collect data from user' action in a workflow - which generates a custom form within the workflow folder. The form...:EcmaScriptEncode($ListName),'};'))}"&gt;&lt;/input>&lt;/td> I need to add javascript within the DataFormWebPart so I can update another form field when the user clicks the 'Complete Task' button. I...;@_CopySource,Copy Source;@ContentTypeId,Content Type ID;@_ModerationStatus,Approval Status;@_UIVersion,UI Version;@Created_x0020_Date,Created;@FileRef,URL Path;&lt;/datafields> &lt;XSL> &lt

  • information using GetList. I use the List GUID as the list name. An exception is thrown. The SOAP body is shown below. &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;soap:Envelope xmlns:soap="http...;errorstring xmlns=""&gt; Die Liste ist nicht vorhanden. Die ausgewählte Seite enthält eine Liste, die nicht vorhanden ist. Die Liste könnte von einem anderen Benutzer gelöscht worden sein. &lt;/errorstring> &lt;errorcode xmlns=""&gt;0x82000006&lt;/errorcode>

  • I have this (an attempt to solve the task): &lt;xsl:stylesheet xmlns:x="" xmlns:d="" version="1.0" exclude-result-prefixes..."/&gt; &lt;xsl:value-of select="sum($Rows/@Distance[.!=''])" /&gt; &lt;/xsl:template> &lt;/xsl:stylesheet> The result is: "NaN", so I figure that my XSLT is wrong. Question.../@Distance[1]"/&gt;&lt;/xsl:call-template> &lt;xsl:template name="xsum"&gt; &lt;xsl:param name="currnode"/&gt; &lt;xsl:param name="res" select="0"/&gt; &lt;xsl

  • , but that ends up rendering the actual anchor tag, as opposed to a clickable hyperlink: &lt;a href=""&gt;;/a> So then I tried creating a XSL transform, since... confirm (or deny) that the following looks legitimate (or suggest a better way to do it)? &lt;xsl:stylesheet xmlns:x="" xmlns:d="" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="" xmlns:asp="" xmlns:__designer

Data information