Question


I had deployed feature with web part, assembly version 1.0.0.0. Then I have implement some changes in my solution and changed assembly number to 1.0.0.1. WebPart and feature version has been changed to 1.0.0.2. After that I uninstalled solution from SharePoint and than installed new version. Now I'm not able to preview web part because SharePoint is trying to link to webpart version 1.0.0.1 and I'm getting "Unknown error".
This is my feature.xml file:

<?xml version="1.0" encoding="utf-8"?>
<Feature
    Id="E2E13BDD-D78E-4820-97FF-3248188EA22C" xmlns="http://schemas.microsoft.com/sharepoint/"
    Title="CurrentNewsFeature"
    Scope="Site"
    Hidden="False"
    Description="CurrentNewsFeature"
    Version="1.0.0.2">
    <ElementManifests>
        <ElementFile
            Location="CurrentNewsFeatureUserControl.ascx" />
        <ElementFile
            Location="CurrentNewsFeatureWebPart.dwp" />
    </ElementManifests>
</Feature>

and my CurrentNewsFeatureWebPart.dwp:

<?xml version="1.0" encoding="utf-8"?>
<WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">
  <Assembly>CurrentNewsFeature, Version=1.0.0.2, Culture=neutral, PublicKeyToken=1757a812a567b868</Assembly>
  <TypeName>CurrentNewsFeatureWebPart</TypeName>
  <Title>Sabre News From Blog</Title>
  <Description>WebPart to display general news from a blog.</Description>
</WebPart>


What is wrong with my solution? Howto redeploy this WebPart?
I have SharePoint version 2007.

Was it helpful?

Solution

Feature version and assembly version are 2 distinct things, and do no related each other. Basically, it feels like you tried to increase the version of the assembly, and most likely the result from building it is not that one.

As for the "Unknown error" this is due to the fact that debugging is not enabled in your web.config file for the Web Application (search for debug=false and replace to true and customErrors from On/RemoteOnly to Off, also set CallStack to TRUE).

You need to make sure that in your .dwp file you are actually referencing the appropriate assembly. Use either Reflector (not free anymore unfortunately) or via a VS Command prompt the sn.exe (http://msdn.microsoft.com/en-us/library/k5b5tt23(v=vs.80).aspx) to extract the full-assembly name, or directly go to GAC and take it from there.

Hope it helps, C:\Marius

OTHER TIPS

All the information in the .dwp (and .webpart) files including the assembly version is only a blueprint for which web part and corresponding properties to load when you select this web part from the WebPart gallary, SharePoints WebPartManager will then store these settings (possibly updated by user) in the content database. Each time the webpart page is loaded the information will be read from the content database.

So if you update the Assembly version all existing instances added to pages will try to load the old version and fail unless you've added bindingRedirects in web.config (see Web Part Versioning with assembly redirection) this is why most SharePoint developers update AssemblyFileVersion instead of AssemblyVersion

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top