This article mainly discusses some experiences and problems in establishing a solution when using vs2005/2008 during team development.
As the project grows, the number of projects and the number of files in the project keep increasing. Each compilation will take more time. How can we reduce the compilation time and improve the development efficiency?
We know that there are several methods of vs reference, such as GAC, project reference, Assembly reference, and Web reference. each project can reference another project. In this way, when solving the issue of generation, vs automatically determines the order of Generation Based on the project dependency. when a project is generated separately, the related project on which it depends is automatically generated at the same time. This does bring us some convenience, but as mentioned above, once there are many items, this compilation may take a long time.
To solve this problem, I have summarized some experiences, that is, the reference before the project can not directly reference the project, but use the reference assembly method. first create a lib directory under the solution directory, open the properties page of the project, Point "output path" to the lib directory, compile the current project, other projects that need to reference this project add DLL references generated in the lib directory. in this way, each developer only needs to build their own solutions to add the part of the project they are responsible. compilation speed is also accelerated. however, when the dependent project is changed, remember to re-compile the project to take effect, and the related dependent project will not be automatically compiled. other third-party assemblies can also be stored in this directory. If there is an update, replace it and re-compile it. if multiple programs deployed on the same server need to reference the same assembly, for example, enterpriselib, you can add it to GAC, this improves the efficiency without having to keep a separate copy for each program.
By the way, there may be several reasons for separating different classes into different assembly:
1. During the upgrade, you only need to upgrade the relevant components.
2. reflection can be used to dynamically load different component assembly to make the program more flexible.
3. Facilitates Assembly reuse.
4. assemblies developed in different development languages can be referenced from each other.
If the project is not big enough, you can put it in an assembly and do not layer it for layering. For example, blogengine only has one project ;)
Reasonable separation can make programs do not load unnecessary programs, but it should not be too much divided. Microsoft also prompts that it is time to merge several small sets into large ones. assembly loading also takes time.
In addition, vs2005 and vs2008 can share project files. You only need to create two versions of solutions respectively. However, note that the encoding style should follow the 2.0 standard. for example, automatic attributes cannot be used, although they can work well in the 2.0 project created in vs2008 (that is because it uses a later version of the compiler ).