Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SharePoint 2010 VS development: Intellisense for ASPX files

I'm using Visual Studio 2010 to develop a SharePoint Server 2010 solution. Part of this includes custom Page Layouts, but when editing them, intellisense is completely broken, since Visual Studio doesn't appear to know how to handle them. Here's what I've done:

  1. Created a new blank solution
  2. Right-clicked on the solution and created a new "Empty SharePoint Project"
  3. Right-clicked on the project and created a new "Module"
  4. Renamed sample.txt to MyPageLayout.aspx or created a new ASPX Web Form

At this point, intellisense for the new Page Layout is broken. It gets even worse with tools like ReSharper installed. Also, things like "Format Document" will break the Page Layout (by for example changing asp:Content to asp:content)

What I've tried to get intellisense working:

  1. Added a Web.config from a standard Web Application Project to the root of the SharePoint Project - made no difference.
  2. Added the ProjectGuid for a Web Application Project to the SharePoint project file - broke the project.

Is there any way to get intellisense, and the rest of the support Visual Studio can offer for Web Forms, available when developing SharePoint 2010 Page Layouts?

like image 343
ScarePoint Avatar asked Dec 07 '10 15:12

ScarePoint


1 Answers

I have followed your post to some extent.

Using VS2010 (On an x64 machine)

  1. Create a blank SharePoint solution. (this properly combines your #1 & #2)
  2. Add a module (in SharePoint a module is like a folder or resource container)
  3. added a new class to the module (intellisense present)
  4. Added a new webpart to the module (intellisense present)
  5. added a user control to the project designer works and (intellisense present)

I believe that you should consider creating true server or visual web parts. This will have a harder learning curve but will pay with dividends in the future. You will be able to package and deploy your solution again or to another server/farm. Aspx pages can be added and manipulated by the dreaded SharePoint designer. In 2010 the theory is that those designer mods can be packaged and deployed.

I work in this environment every day and the best advice I can give is to embrace the SP object model and do 'it' the sharepoint way. Don't try to force SP to be something its not. :)

Here is the C# viewHere is the markup view

like image 74
Joe Johnston Avatar answered Oct 03 '22 09:10

Joe Johnston