Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have been using VS2010 for developing web parts and deploying them to MOSS 2007 for quite some time. Unfortunately, I had to work on a fresh copy of WINDOWS with all software including MOSS 2007 & VS2010 installed. I create a simple Hello world webpart and build it, it builds fine. When I try packaging it, it says

Error: "Object reference not set to an instance of an object.

Any help will be deply appreciated. I have been trying the solution from last 2 hours, but no luck :( Edited..Code below:

[ToolboxItemAttribute(false)]
public class WebPart1 : WebPart
{
    protected override void CreateChildControls()
    {
        Controls.Add(new Label() { Text = "Hello, world!  Compiled in Visual Studio 2010!" });
    }
}
share|improve this question
    
May I Know why the question was downvoted? –  Nitesh Nov 21 '11 at 19:16
    
Sorry, I forgot add comment. If you have this exception, you tries to access to the object that is not created. In this case stack trace or log messages are helpful. –  Alexander Nov 21 '11 at 19:30
    
@Alexander...A simple webpart printing "Hello world" is giving this error. Not sure, why..what classes may I be referencing that can throw this error? Any ideas? –  Nitesh Nov 21 '11 at 19:45
    
What code's in your web part? –  James Love Nov 21 '11 at 20:06

2 Answers 2

I think that you should do a little hacking. I hope, this approach will solve your problem.

share|improve this answer
    
its the same solution posted by Corey Roth at dotnetmafia. I have followed the same but no luck :( –  Nitesh Nov 21 '11 at 20:05
1  
are you sure that the solution uses version 12 DLLs and you removed SharePoint version attribute from solution schema? –  Alexander Nov 21 '11 at 20:12
    
yes..checked in references and manually removed them.. –  Nitesh Nov 21 '11 at 20:14
    
you opened your MOSS2007 server, copied Microsoft.SharePoint.dll and Microsoft.SharePoint.Security.dll to the folder in your solution, add references to these DLLs. and now you can see 12.0.0.0 version af DLLs in references properties. Am I right? I would like to be sure that you did not add the 14 DLLs again. –  Alexander Nov 21 '11 at 20:23
    
yes, the server I am developing does not hv installed MOSS 2010 installed.. –  Nitesh Nov 21 '11 at 20:27
up vote 0 down vote accepted

Finally ended with up creating solution as described here.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.