Showing posts with label SharePoint. Show all posts
Showing posts with label SharePoint. Show all posts

Wednesday, June 2, 2010

SharePoint web part deployment error: Object reference not set to an instance of an object error

After deploying a SharePoint web-part developed using VSeWSS I get:
"Object reference not set to an instance of an object error"

Solution: copy the web part DLL to the GAC (it's also possible to register the DLL to the GAC on the batch file 'setup.bat' created by VSeWSS by calling gacutil.exe).

Wednesday, August 26, 2009

SharePoint writes 'Unknown Error'

The following post was very helpful:
http://koenvosters.wordpress.com/2009/08/06/showing-the-real-error-message-in-sharepoint/ - It Shows how to set the IIS to display the full stack trace.

Wednesday, May 20, 2009

SharePoint Web-part dev problem - List does not exist

Problem:
I was working on a web-part with a custom ASPX file. It was working just fine for the root site of a site collection, but when testing it on a subsite it failed to load the ASPX file with the following exception:

List does not exist

The page you selected contains a list that does not exist. It may have been deleted by another user.

Solution:
There are few suggestions that didn't help me on the web. With the good old method - remove everything and check what's making the problem I found the perpetrator: in the ASPX page, I used SharePoint:FormattedStringWithListType, which caused the exception.

Using reflector I found that FormattedStringWithListType has a property 'List' which opens SPList with the current SPWeb context (list GUID is taken from the request parameter named 'List'). At this point I noticed that when the ASPX file is opened, it is done from the site collection level & not the sub site level.

From here there are few possible solutions:
*. Open the ASPX file from the subsite level (probably the best solution).
*. Don't use the class FormattedStringWithListType
*. Copy with reflector & fix the problem using SPSite.

Thursday, January 8, 2009

WebPart wsp does not include dependent DLLs

I was trying to develop a webpart for SharePoint 2007 & WSS3 using Windows SharePoint Services 3.0 Tools: Visual Studio 2005 Extensions, Version 1.1.

Everything worked just fine, until I found out that the WSP file created by the add-on does not include dependent DLLs (from other projects in the solution). I could not find any good solution, so finally I had the following options:

1. In post-build event, use ILMerge to merge all the DLLs into a single DLL with the name & key file of the webpart, and replace existing DLL with this new merged DLL.

2. Add the dependent DLL to the project files of the webpart. This way the WSP file includes the dependent DLL. An improvement: add the DLL file in the following directory: bin/Release/ (change the project file with notepad) - this way any new compilation will include the new DLL.

3. Probably the best option - use a 3rd party tool to create the WSP file - WSPBuilder for example.