3
votes

I'm working on a Sharepoint 2010 project that has quite a few visual webparts.

Currently I have all web parts in the same solution. My colleague is working on the same project, but is creating a project for each web part inside the solution.

What's the best practice here? What are the advantages/disadvantages of each approach?

thanks.

4

4 Answers

6
votes

I tested both approaches when I started developing Sharepoint solutions and I conclude the following Pros / Cons:

Pros of having separate project for every webpart:

  1. much faster deployment and testing of your code changes <- you don't have to deploy all the webparts everytime you make a single change.
  2. easier and better team collaboration <- usually every developer works on a single webpart this way, everyone's code is separated and there won't be checkin/checkout conflicts.
  3. better code reusability, if you needed at any time in the future to use a single webpart in another project you will find it much easier to just go and get the webpart project.
  4. All webpart resources in a single place, usually the webpart uses some resources (resx / images) which you can include in it's project, imagine having a big solution and all the resources of all webparts are spread around in a single project, it's much harder to just get your webpart to use it in another future project because you have to find all related resources.

I hope that's enough to let you enjoy the Webpart per project appreach.

2
votes

All in one project unless there's a good reason to break them out (i.e. they need to be delivered separately).

1
votes

It is about deployment. A single project results in a single wsp file, so if you want to deploy all web parts together, stick to the single project. Otherwise, split them up as appropriate.

0
votes

If its a big project, a seperate project for each webpart could be an overkill. Unless there is a good reason (such as deployment), all should be in same project.