none
Error occurred in deployment step 'add solution'. Object reference not set to an instance of an object

    Question

  • Hi,

    I am trying to create my first webpart. This webpart contains hello webpart lable only.

    There is no error while build or a package is selected it runs successfully.

    When I try to deploy it gives me the above error.

    There is one more issue which I think is related to the same error.

    I am trying to insert/add new records in my lists and document libraries but I am unable to do the same. No error is shown and the record also is not added in the list.

    Please help.

    Thanks,

    Harshal

    Monday, February 13, 2012 5:20 PM

Answers

  • Hi Harshal,

    From your description, it seems to be a permission issue, please check the permission of the user that running the code, and try to use site owner or administrator to run the code to check whether it works.

    Also, as you said, you cannot insert new item to lists and libraries, did you add list items using code or from UI, if from UI, if having permission, would you please try to use another user with contribute permission to check whether the items can be added.

    Thanks,
    Qiao


    Qiao Wei

    TechNet Community Support

    • Marked as answer by Shimin Huang Friday, February 24, 2012 7:14 AM
    Wednesday, February 15, 2012 9:56 AM
    Moderator

All replies

  • Below link are of steps by step & a video on how to create a webpart in VS 2010

    Follow these steps

    http://weblogs.asp.net/sreejukg/archive/2011/03/26/create-a-visual-web-part-using-visual-studio-2010.aspx

    & Watch this video

    http://msdn.microsoft.com/en-us/vstudio/Video/ff623014


    Happy Sharepointing... Regards SPTECH07

    Monday, February 13, 2012 5:51 PM
  • Hi,

    I have followed all the steps mentioned in the video. My code is a sandbox solution and when I try to deploy the code to the site collection it gives me the above error.

    Monday, February 13, 2012 5:58 PM
  • It would be really difficult to earmark what is the exact issue without the code.

    If you can share the code, we can try debugging the issue for you.


    Varun Malhotra
    =================
    If my post solves your problem could you mark the post as Answered or Vote As Helpful if my post has been helpful for you.

    Tuesday, February 14, 2012 1:24 AM
  • Hi Harshal,

    From your description, it seems to be a permission issue, please check the permission of the user that running the code, and try to use site owner or administrator to run the code to check whether it works.

    Also, as you said, you cannot insert new item to lists and libraries, did you add list items using code or from UI, if from UI, if having permission, would you please try to use another user with contribute permission to check whether the items can be added.

    Thanks,
    Qiao


    Qiao Wei

    TechNet Community Support

    • Marked as answer by Shimin Huang Friday, February 24, 2012 7:14 AM
    Wednesday, February 15, 2012 9:56 AM
    Moderator