8
votes

Suppose I created a custom web application that consists of:

  • several assembly DLLs: web app, business logic, data services
  • multiple aspx pages and ascx custom controls that use them
  • custom configuration section
  • custom HTTP module

More or less the usual stuff.

I would like to deploy it to a particular sharepoint site under a certain subfolder. So if I access my sharepoint site via http://myserver:90/ (because I'm not using sites/some_site) I'd like my application to be available under http://myserver:90/webapp

I could manually add a virtual folder (not application because I would need to access some Sharepoint site's data) to my sharepoint site in IIS and manually edit site's web.config file to register my HTTP module and add my custom configuration section as well either putting my DLLs into GAC or put them in the _app_bin (so I don't have problems with CAS), but I don't think that's a good thing to do, because this web application may get deployed in an environment where this shouldn't/couldn't be possible.

So I figured I could build a WSP using Visual Studio 2010 and deploy it that way. But I don't have enough experience doing that.

I created a new sharepoint 2010 project. Is there a way I could add all non-executable application files (aspx, ascx) at once? I've seen the advanced tab of the WSP package where I can add my DLLs either to bin folder or GAC. I don't know whether I would also have to add any safe control and register certain classes?

So I suppose I need some pretty detailed and explanatory guidance here.

1

1 Answers

4
votes

The only real way to do this would be to use the layouts folder to deploy your application via the wsp. This will let you depot any files that you would normally deploy with a.web application.

There are couple of problems however. The URL for your application will be http://SharePoint/somesite/_layouts/yourapp

This is a blessing and a curse. Your urls will be ugly but they will work under every SharePoint site. If your application depends on SharePoint context to function, that context will automatically be available based on the requesting URL.

To add a layouts folder under your share point project right click on the project and add a mapped folder to layouts. I would also recommend adding a sub folder under layouts for your application so that your application files don't conflict with the default files directly in the layouts folder.

For the http module, or any web.config modifications, you can use the spwebconfigmodification class.

Heres a walkthru: http://sharepointsolutions.blogspot.com/2006/12/using-spwebconfigmodificat_116736917110571614.html