VS2005 – Web Application Projects or Web Site Projects? and SharePoint
When using VS2005, one of the things users (coming from VS2003) encounter is a new compilation model for Web projects. (Web Site Project). There are several differences between one model and the other, from where they are selected to create a new project to the compilation results. For many things this is very important, so although this is not a new topic I return to it for my own reference and that of others.
In the Web Application model:
· The entire application compiles into a single assembly (dll) that ends up in the bin folder.
· All references and files are related in the project file.
· The entire compilation process uses MSBuild so you can customize what happens before, during and after compilation.
In the Web Project Model:
Many dlls are generated that live in the bin directory, it is a bit complicated to know what each one is for and which is which.
For me then the main difference is related to compilation, and this is where this becomes important today. (3 years after VS2005.)
Now I am developing some projects for Sharepoint 2007, there are many options but an interesting one is to create a normal asp.net application, add the references to Sharepoint and publish it in the _layouts directory.
To do this and have it turn out well it is mandatory that the web application assembly be a single one, that is, that it be a Web Application project. , there are other scenarios such as using Enterprise services in which that single assembly thing is also important. So for many people, this turned out to be so important that an add-on for VS2005 was created that allows having Web Application projects again.
Below are some photos from my development machine (thanks clo J) that allow seeing the differences at creation time, the compilation results and the resulting deployment in sharepoint.
When you enter Visual Studio and select new web site you see a screen like this:
if you create a page, a button, a class, compile and publish (Publish) you get something like this:
As you can see there are two dlls, one called application Code and another called App_web_xxxx.dll.
To have support for Web Applications you can go to the Microsoft site and quickly install it following these steps:
1. First Apply this patch and
2. Then download the add-on from here.
After installing this you still have the web projects, but now there is also the option of web applications, only they are found elsewhere as you can see here: (new Project, Web…)
And when adding the same page, the same button, the same class as in the previous project, compiling and publishing you get this:
As you can see a single dll with the same name as the project.
Well, this dll is the one that can be placed in the BIN folder of the virtual directory of the site on which the application is being created in sharepoint.
like this: (In this case my application inside Sharepoint is called ProjectServer)
And the compiled pages do end up in the layouts directory:
Personally I like projects that use webApplications, and so far I have not found any restriction or anything I cannot do, even in another project that used Enterprise Services from one of the Web Site classes it was perfect for easily registering the components in the COM+ console.
I hope it is helpful.
Juan Carlos Peláez
MCTS
Distributed Applications
Keywords: VS2005, Sharepoint, Web Application Projects, Web Projects, Sharepoint Applications, Juan Peláez, MCTS Distributed Applications. Build, deploy, Development for Sharepoint, Sharepoint Consultant.
Need Expert Help?
Let's discuss how I can help with your technical challenges
Schedule a Consultation