How to share selected projects in a Visual Studio solution between TFS and GIT?

157 views Asked by At

I have a VS 2013 solution with a primary project building a class library (accompanied by Sandcastle Help File Builder project for documentation and a couple of helper libraries). In addition, the solution includes a dozen of code sample projects (console apps). The code samples are used by the Sandcastle project. The solution is checked into a private TFS repository.

I need to move the code sample projects to a public GIT repository (to make samples available to clients), so they need to be shared between the GIT and TFS repositories.

What is the right way to do this? I found a few posts explaining how to share the same solution between TFS and GIT, but I only want to share selected projects from the solution. So do I need to create a separate solution for the samples only? If so, do I need to move this solution to TFS, too? Does TFS support shared projects? Will it be able to resolve Nuget packages between the solutions?

If this makes a difference, the sample projects are not located under the main TFS solution folder (there is a reason for this). The project folder structure looks like this:

- Main\
-- Samples\
---- Sample1\
------ Sample1.csproj
---- Sample2\
------ Sample2.csproj
-- Library\
---- Library.sln
---- Lib\
------ Lib.csproj
---- Helper\
------ Helprer.csproj
---- Sandcastle\
------ Sandcastle.shfbproj

The solution file (Library.sln) references all projects under the Library folder (Lib.csproj, Helper.csproj, etc) as well as all sample projects (Sample1.csproj, etc).

1

There are 1 answers

1
Andy Li-MSFT On

I think the best way is creating a separate solution for the samples only, also including the referenced libiaries, then publish it to external Git (eg: Github) to share.

You don't need to move it to TFS, in 2015 and later version of TFS, it's supported to build with external git, this sample for your reference. Of cause if you want to maintain the projects locally with TFS, you can move it to TFS. Then keep Git repository in sync between TFS and Git.

TFS can share the projects's sources with the permission set for specific users. So, you can also create TFS accounts for clients to share the projects sources with them if there are no security policy limits. See permission settings for details.