I have a few different applications that i need to share code between to reduce maintenance. I have tried to read a lot on stackoverflow and the web in general and it is a fairly common problem; i have not found an answer i like.
Our TFS branching structure is like this. We have three branches Development, Main and Production. On the Development branch all active development is done, when we are done with developing new features, we merge it with Main, and then to production. The production branch is always the code running on the servers. If we detect bugs that must be fixed before the next iteration. The changes are done in main, and merged with Production as we deploy. The applications that need to share code do not share a common branching hierarchy or a common iteration schedule. In fact one of the applications only go through a 1month iteration once a year. (I know this differs slightly from the conventional way of doing it.
During my research i have found a few different solutions, but i have problems with all of them.
Binary sharing: One of the common ways i found was branching the compiled binary into the a folder beneath the development branch. My problem is that if we where to detect bugs in the shared code that must be fixed fast, the code in question is compiled. And if we where to fix the bugs we would get all the changes done to the shared code base.
Project sharing: My main problem here is how it can be done in an acceptable manner. My initial idea was to when a new iteration started, merge the changes from the main branch with the shared code to update it. Merge the main with the development branch to update the development branch with changes as a result of bugfixing. And branch new updates version of the shared code into the development branch. But from what i understand this is not supported by TFS because i would create nested branches.
My question is: How can i share a few common projects between solutions while keeping them in isolation and be able to fix bugs on the Main branch without worrying about the common projects having changed and therefor introducing new bugs. But still be able to fix bugs in the common project and merge those fixes back into the shared common projects.