Thursday, August 1, 2013

Error Creating Control - Cannot find Web Project Item

I created a new SharePoint 2010 Visual Web Part project in Visual Studio 2012, and got the error message below when open a .ascx file in design mode:

Error Creating Control - LinkButtonSubmitCannot find web project item '~/sites/Sandpit/vwpUserProfileUpdate/vwpUserProfileUpdate.ascx'.

Warning message is:

Warning    1    E:\EricFang\VisualStudio\somepath\usercontrol.ascx: ASP.NET runtime error: Path cannot be null.
Parameter name: path    E:\EricFang\VisualStudio\somepath\usercontrol.ascx    1    1    usercontrol


I even could not drag and drop any control from the tool box to the web form.

I built some similar projects before, and this was the first time that got this error. So I compared the .csproj file with other projects, but didn't notice any difference which cause the problem.


Then I spent a while searching on internet. Many developers got similar issues, such as here and here, but they don't suit my case.

In the end, quite lucky, I noticed that in the "Site URL" of the project, I used the server alias name instead of the computer name. Since it wouldn't hurt, I changed it, and BING! The problem disappeared!

(This value is actually stored in ".csproj.user" file)

1 comment:

  1. Thanks for your post! If only I could have the hours back that I spent searching until I finally came across your post.

    ReplyDelete