Friday, September 04, 2009

Integrating ASP.NET Applications with SharePoint

Jamil Haddadin has an excellent post on how to perform ASP.NET related development with Visual Studio extensions for Windows SharePoint Services.

However during the development phase and due to the frequent changes we make it’s more efficient to work with the ASP.NET application directly, that will be much easier than the “coding/deploying to SP/testing” cycle you will use if you worked with the VSeWSS.

When you use the method described by Jamil you will find that you will not be able to build the ASP.NET application because of using strongly named class names in “Inhertis” attribute of the Page/Control directives.

To resolve this i don’t add the assembly name part in the “Inherits” attribute i just put the class name like the following

<%@ Page Language="C#" AutoEventWireup="true"

MasterPageFile="~masterurl/default.Master" %>

This will allow you to successfully build and run the ASP.NET application, but when it comes to building and deploying to SharePoint, you will have to add the assembly info to the class name as follows

<%@ Page Language="C#" AutoEventWireup="true"

Inherits="MyApp.Portal.Forms.Customers, MyApp.Portal, Version=, Culture=neutral, PublicKeyToken=9f4da00116c38ec5"
MasterPageFile="~masterurl/default.Master" %>

so i created this simple add-in that will iterate over all the *.aspx and *.ascx files in your project and inserts or removes the assembly info in the “Inherits” attribute of the Page/Control directives1

so before you deploy to SharePoint just run this add-in and it will take care of everything :)

you can download the add-in from below

1 comment:

Jamil Haddadin said...


Please note that I have recently migrated my blog, so you can find this article here:

Thank you for reference.