Sharepoint development - multiple webparts in same solution, or project for each?
I'm working on a Sharepoint 2010 project that has quite a few visual webparts.
Currently I have all web parts in the same solutio开发者_StackOverflow中文版n. 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.
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:
- much faster deployment and testing of your code changes <- you don't have to deploy all the webparts everytime you make a single change.
- 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.
- 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.
- 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.
All in one project unless there's a good reason to break them out (i.e. they need to be delivered separately).
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.
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.
精彩评论