How to change soure control from TFS? - tfs

I have a solution say it Myproject in vs2010. I have create a solution folder on TFS say it $/Myproject and checked in all source code files.
Now I have created another folder on TFS say it $/Myproject2 and I want to the solution Myproject in VS 2010 to connect to $/Myporject2.
I guess I should disconnect from TFS and then connect to $/Myproject2 and check in all codes, but not sure how.
So I try to go to workspace->Edit Wokrspace, and change the Source Control Folder in the list. Is it right?
Thanks.

Map your workspace to $/ and you'll be able to access both $/Myproject and $/Myproject2
However, I don't recommend having one team project be able to reference another team project. If you're going to have these types of dependencies, I would have a layout more like this:
$/MySolution
MyProject
Project.csproj
MyProject2
Project2.csproj
Where "MySolution" is the master product you are trying to build.

Related

VS Code TFS is showing wrong project

I have setup Team Foundation Server support in my VS Code. As the docs say I open the workspace folder and the extensions sees there is TFS support in this workspace but the project shown in the status bar is for another project on the TFS.
What is wrong here?
Generally it will display the Team Project name which is based on your workspace when you connect to TFS.
So, if you mean the wrong Team Project name, then you need to check your workspace first, make sure it's really mapped to the correct Team Project.
You can also try to create a new workspace and map to the specific Team Project, then check it again.
If you mean the wrong develop project with the specific solution, then you can switch to the correct project/solution by clicking the switch button at bottom-right corner.

Can I check in code to another project in TFS 2013?

I'm writing code in a TFS 2013 Project. I'd like to check it into a different Project on the same server. Can I do this? Thanks
You can not directly check in the code to another project, you need to add the code file to another project first for source control, then check in the code changes.
In visual studio Team Explorer:
Connect To TFS project 1, configure the workspace and map source
code to local folder1. Open the folder1 in windows explorer.
Connect To project 2, configure the workspace and map source code to
local folder2. Open the folder2 in windows explorer.
Copy the code file which you want to check into another project (eg,
project 2 here ) from folder1 to folder2, then the system
will detected the new added files under Pending Changes >
Excluded changes.
Click the Detected link to Promote the new added files.
Check in the files to Project 2
Refer to these articles for more information : Add files to the server
and Check in your work to the team's codebase
UPDATE:
You can link to the WI in the same collection, but cannot link to the WI which in another collection.
That means, if the team projects are in the same collection, then you can link the WI (associate with the changeset) which belongs to another project directly.

TFS Linked Files Not Found

I have a core project and several sub projects. I link to files in the core project for the sub ones. I righted clicked my csproj and said existing file > add > link. Here is how my project looks:
Here is a picture of my Windows Explorer:
When I check in, I receive this error:
Could not find file C:\Users\joe_a84\Documents\JMASoftware\QuickBooks\Main\Source\Platform Support\NOP\Source\Versions\nop265\Nop265\Module\QuickBooksSettings.cs
The file does not exist there because it is linked. How can I tell TFS that it's a linked file?
There is the following question which states that symbolic links are not supported in TFS 2008 or TFS 2010. Symbolic links in TFS 2010 Source Control?
However, I did find the following ancient blog post which seems to show how to do it for TFS 2005: http://blogs.msdn.com/b/ericlee/archive/2006/07/20/sharing-files-in-team-foundation-server.aspx
That said I would highly recommend that you simply don't do this.
If you really need to share a file between projects then you should be using the branching functionality built into TFS. Typically you don't want just a single code file due to namespace and assembly generation concerns. It is much cleaner, and certainly easier to maintain, by having a separate project for those artifacts that are passed around. This way you either branch the entire assembly project; or just refer to it in it's normal place.
This is a local file level linking by another project. There is only one file at a specific subfolder. Other projects can link to the file via this approach. The problem with this approach is that from TFS viewpoint, you cannot tell if a file is shared by other projects. A good practice will be to keep such files in separate folder with name like Common or Shared etc.
People who have been using File linking across branches in Source Control would have to change their approach quite differently.
Linking between files in TFS is pretty simple. You just open the "Add existing item" dialog and search for the file you want to link in your local workspace. If you would click "Add" now Visual Studio would create a copy of the file in your projects directory. What you do instead is to choose the other option (you have a little drop down menu on the button) and add the item as a link. Thats it.
I faced the same problem. I just did undo on the file which was showing this error in the TFS Pending Changes window and checked-in. This undo did not remove the link that was added in the project. Make sure you do not undo the project file.

Team Foundation Server: Move Root-Level Project

I'm trying to clean up our work-site Team Foundation Server 2010 defaultcollection.
Unfortunately we originally set it up with a whole bunch of projects at the root level of the defaultcollection.
Now we want to clean it up by moving a bunch of those projects into a root-level archive directory, while preserving the history of the projects.
This is proving extremely difficult. I've read a bunch of stuff online and run some trials, but I'm still having issues.
Part of the problem is that projects at the root level seem to be "immune" to a bunch of "normal" actions you can perform on projects in general, such as the Move command (which is greyed-out).
If I try to use the command line to perform the move like this:
tf.exe move $/TestProj $/Archive/TestProj/
I get:
TF10169: Unsupported pending change attempted on team project folder $/Test. Use the Project Creation Wizard in Team Explorer to create a project or the Team Project deletion tool to delete one.
So I figured I'd move the contents like this:
tf.exe move $/TestProj/* $/Archive/TestProj/
That worked, and history was preserved, but then when I deleted the original project like this:
TFSDeleteProject.exe /collection:MYSERVER\DefaultCollection TestProj /force
History was lost!
Those aren't "root level projects". Those are "Team Projects". There's a lot more to a team project than just source control, so, no, you can't do the same things with a "team project folder" as you could with a lower-level folder.
TFS does not use the term "project" the same way that SourceSafe did. In SS, "project" meant pretty much the same thing as "folder".
You can try the /keephistory option... as I understand it, that is supposed to allow you to do what you are trying to do.

branching team project

I have the following at Source Control Explorer
TFSServer/teamCollection
+ teamproject
Is is possible to branch /teamproject to /teamproject-dev? The output should be
TFSServer/teamCollection/
+ teamproject-dev
I tried and it gave me error:
TF10175: The team project folder $/teamproject-dev does not exist. Contact your Team Foundation Server Administrator and ask that it be created.
Top level folders in source control are reserved for team projects. If you create a new "teamproject-dev" project you could branch the code from the existing "teamproject" into the new -dev project via the wizard.
Alternatively set up a proper branching structure inside teamproject. Read the TFS Branching Guide for more information.
Yes, you can convert team project into branch.
The above error is saying that you don't have access to create branch. First you create branch by getting help from TFS admin then try what you mentioned that should work fine.

Resources