如何在TFS的同一路径上添加多个项目/解决方案

时间:2022-09-11 16:31:05

I am working on a C# project which must be built for more than one platform (.Net and CF.Net) and from past experiences I have found that the best approach that works for me is to have multiple parallel solutions present side by side in the same folder corresponding to each platform. All the code files, resources etc are shared by these projects/solutions and are common for all parallel projects.

我正在开发一个必须为多个平台(.Net和CF.Net)构建的C#项目,根据过去的经验,我发现对我有用的最佳方法是并行提供多个并行解决方案与每个平台对应的相同文件夹。所有代码文件,资源等都由这些项目/解决方案共享,并且对于所有并行项目都是通用的。

Eg.

    /SolutionFolder  
        MySolution.sln  
        MySolution_CE.sln  
        /MyProject  
            MyProject.csproj  
            MyProject_CE.csproj  

Now the problem is once I add MySolution.sln to source control I cannot add MySolution_CE.sln. It says something on the lines of "Cannot add two solutions on the same path".

现在的问题是,一旦我将MySolution.sln添加到源代码控制,我就无法添加MySolution_CE.sln。它说的是“无法在同一条路径上添加两个解决方案”。

<edit>
To answer ctake's question, I am trying to add the solution from VS2008 by right clicking on the solution and saying "Add to source control".

为了回答ctake的问题,我试图通过右键单击解决方案并说“添加到源代码管理”来添加VS2008的解决方案。

Also I forgot to mention that I added the solutions manually anyway but VS2008 does not bind to this solution i.e. the files cannot be checked in/out from these "forced" solutions from within VS2008.
</edit>

另外我忘了提到我手动添加了解决方案,但VS2008没有绑定到这个解决方案,即无法从VS2008内的这些“强制”解决方案检入/取出文件。

3 个解决方案

#1


Try using the command line tools - tf.exe, and then setting up the bindings by using the File/Source Controls/Change Source Control... dialog once you've opened the unbound solution.

尝试使用命令行工具 - tf.exe,然后在打开未绑定的解决方案后使用文件/源控件/更改源控件...对话框设置绑定。

#2


Ok, here is a possible work around to this problem. Needless to say it's inelegant but it works nevertheless without going through the pains of writing a custom source control addin for VS2008...

好的,这是一个可能解决这个问题的方法。毋庸置疑,它不够优雅,但它无需经历为VS2008编写自定义源代码控制插件的痛苦......

Steps:

1. Open MySolution.sln in visual studio and then say add to source control then check in the first version.

2. Goto File->Source Control->Change Source control and unbind the solution from the source control.

3. Close the MySolution.sln

4. Open MySolution_CE.sln

5. Goto File->Source Control->Change Source control and bind the solution from the source control by clicking on Bind VS2008 should pick up the correct bindings automatically if the dir structure mentioned in the question was adhered to.

6. Add CE specific files to the solutions/projects and do an initial checkin.

7. Repeat this bind/unbind operation each time you wish to do a checkin from the other solution (I know this is a pain).

步骤:1。在visual studio中打开MySolution.sln然后说添加到源代码控制然后检入第一个版本。 2.转到文件 - >源控制 - >更改源控件并从源控件解除绑定解决方案。 3.通过单击绑定VS2008关闭MySolution.sln 4.打开MySolution_CE.sln 5.转到文件 - >源控制 - >更改源控制并结合从源控制的解决方案应该自动拾取正确绑定如果Dir结构问题中提到的是坚持的。 6.将CE特定文件添加到解决方案/项目中并进行初始签入。 7.每次你想要从另一个解决方案签到时,重复这个绑定/解除绑定操作(我知道这很痛苦)。

Hope this helps.

希望这可以帮助。

#3


The "Add Solution To Source Control" wizard isn't really necessary if you are using TFS + you already have workspace mappings set up. (If you are using another source control system, or the solution folder is not mapped, this is not true.)

如果您使用的是TFS +,则“添加解决方案到源控件”向导不是必需的,您已经设置了工作区映射。 (如果您使用的是其他源控制系统,或者未映射解决方案文件夹,则情况并非如此。)

All you need to do is write bindings into the sln/proj files using the Change Source Control dialog. Unlike the full-blown wizard, the CSC dialog should not have any checks that stop you from binding >1 solution that live side by side.

您需要做的就是使用Change Source Control对话框将绑定写入sln / proj文件。与完整的向导不同,CSC对话框不应该有任何阻止你绑定> 1解决方案的检查。

#1


Try using the command line tools - tf.exe, and then setting up the bindings by using the File/Source Controls/Change Source Control... dialog once you've opened the unbound solution.

尝试使用命令行工具 - tf.exe,然后在打开未绑定的解决方案后使用文件/源控件/更改源控件...对话框设置绑定。

#2


Ok, here is a possible work around to this problem. Needless to say it's inelegant but it works nevertheless without going through the pains of writing a custom source control addin for VS2008...

好的,这是一个可能解决这个问题的方法。毋庸置疑,它不够优雅,但它无需经历为VS2008编写自定义源代码控制插件的痛苦......

Steps:

1. Open MySolution.sln in visual studio and then say add to source control then check in the first version.

2. Goto File->Source Control->Change Source control and unbind the solution from the source control.

3. Close the MySolution.sln

4. Open MySolution_CE.sln

5. Goto File->Source Control->Change Source control and bind the solution from the source control by clicking on Bind VS2008 should pick up the correct bindings automatically if the dir structure mentioned in the question was adhered to.

6. Add CE specific files to the solutions/projects and do an initial checkin.

7. Repeat this bind/unbind operation each time you wish to do a checkin from the other solution (I know this is a pain).

步骤:1。在visual studio中打开MySolution.sln然后说添加到源代码控制然后检入第一个版本。 2.转到文件 - >源控制 - >更改源控件并从源控件解除绑定解决方案。 3.通过单击绑定VS2008关闭MySolution.sln 4.打开MySolution_CE.sln 5.转到文件 - >源控制 - >更改源控制并结合从源控制的解决方案应该自动拾取正确绑定如果Dir结构问题中提到的是坚持的。 6.将CE特定文件添加到解决方案/项目中并进行初始签入。 7.每次你想要从另一个解决方案签到时,重复这个绑定/解除绑定操作(我知道这很痛苦)。

Hope this helps.

希望这可以帮助。

#3


The "Add Solution To Source Control" wizard isn't really necessary if you are using TFS + you already have workspace mappings set up. (If you are using another source control system, or the solution folder is not mapped, this is not true.)

如果您使用的是TFS +,则“添加解决方案到源控件”向导不是必需的,您已经设置了工作区映射。 (如果您使用的是其他源控制系统,或者未映射解决方案文件夹,则情况并非如此。)

All you need to do is write bindings into the sln/proj files using the Change Source Control dialog. Unlike the full-blown wizard, the CSC dialog should not have any checks that stop you from binding >1 solution that live side by side.

您需要做的就是使用Change Source Control对话框将绑定写入sln / proj文件。与完整的向导不同,CSC对话框不应该有任何阻止你绑定> 1解决方案的检查。