in

Corey Roth and Friends Blogs

Group site for developer blogs dealing with (usually) Ionic, .NET, SharePoint, Office 365, Mobile Development, and other Microsoft products, as well as some discussion of general programming related concepts.

Kyle Kelin on .Net

Invalid WebPart Tag Error: One Possible Cause

I recently (as in 5 minutes ago) ran into this error and thought I would share since it cost me a good hour of work today. I have a WebPart that I need to add another assembly to. The second assembly was responsible for getting data from Active Directory. So I went through all the hoops of adding the assembly

  • Strong name the assembly and added a reference to my WebPart project.
  • Made an entry into the manifest.xml file
  • Made an entry into the wsp_structure file.

Now that should be it but when I tried to add the WebPart I now got an error that said Invalid WebPart Tag. What the hell does that mean? The log didn't provide much more additional information. Eventually I noticed a mistake in my manifest.xml file. Take a look at the before and after.

Here was my original manifest.xml file.

 

<WebPartManifest xmlns="http://schemas.microsoft.com/WebPart/v2/Manifest">

  <Assemblies>

    <Assembly DeploymentTarget="GlobalAssemblyCache" FileName="Infusion.WebParts.dll">

      <SafeControls>

        <SafeControl Assembly="Infusion.WebParts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=434425b09396c611" Namespace="Infusion.WebParts" TypeName="*" Safe="True" />

      </SafeControls>

    </Assembly>

</Assemblies>

<Assemblies>

    <Assembly DeploymentTarget="GlobalAssemblyCache" FileName="Infusion.DirectoryServicesHelper.dll">

      <SafeControls>

        <SafeControl Assembly="Infusion.DirectoryServicesHelper.dll, Version=1.0.3058.16424, Culture=neutral, PublicKeyToken=3e458cd467f1ce4f" Namespace="Infusion.DirectoryServicesHelper" TypeName="*" Safe="True" />

      </SafeControls>

    </Assembly>

 </Assemblies>

  <DwpFiles>

    <DwpFile FileName="Infusion.WebParts.DisplayUsersFromADGroup.dwp" />

  </DwpFiles>

</WebPartManifest>

 

 

Here it is done correctly

------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

<WebPartManifest xmlns="http://schemas.microsoft.com/WebPart/v2/Manifest">

  <Assemblies>

    <Assembly DeploymentTarget="GlobalAssemblyCache" FileName="Infusion.WebParts.dll">

      <SafeControls>

        <SafeControl Assembly="Infusion.WebParts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=434425b09396c611" Namespace="Infusion.WebParts" TypeName="*" Safe="True" />

      </SafeControls>

    </Assembly>

    <Assembly DeploymentTarget="GlobalAssemblyCache" FileName="Infusion.DirectoryServicesHelper.dll">

      <SafeControls>

        <SafeControl Assembly="Infusion.DirectoryServicesHelper.dll, Version=1.0.3058.16424, Culture=neutral, PublicKeyToken=3e458cd467f1ce4f" Namespace="Infusion.DirectoryServicesHelper" TypeName="*" Safe="True" />

      </SafeControls>

    </Assembly>

 </Assemblies>

  <DwpFiles>

    <DwpFile FileName="Infusion.WebParts.DisplayUsersFromADGroup.dwp" />

  </DwpFiles>

</WebPartManifest>

 

Yes I know this is a pretty obvious mistake but when you get such a general error message it is touch to track down.

Comments

No Comments

Leave a Comment

(required)
(optional)
(required)
Add

About KyleKelin

Kyle Kelin has been implementing software in the Microsoft space for the past 6 years mainly as a consultant. His interests are SharePoint, .NET, JQuery, and Silverlight.
2019.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems