Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Unbound Solution from TFS

Tags:

export

tfs

unbind

I have an open source project that I want to package into a .zip file containing the binaries and the source. The project is hosted on CodePlex and uses TFS as the source control. I am not sure how to export the project to remove all source control bindings. That way people can easily open the solution locally without getting a login prompt. This functionality is called Export in Git, but I'm not sure how to do the same thing in Team.

like image 772
Travis Parks Avatar asked Apr 05 '12 12:04

Travis Parks


2 Answers

Here's an alternative answer.

I copied and pasted a solution with its projects from one location to another and I am not getting prompted to connect to source control when I try to open it in the new location.

When I go to the File->Source Control->Advanced->Change Source Control, I do not have the ability unbind. So I opened the solution file in a text editor and removed the following section:

GlobalSection(TeamFoundationVersionControl) = preSolution
....
EndGlobalSection

Seems to be working; I hope it helps someone.

like image 167
Tyler Morrow Avatar answered Oct 10 '22 14:10

Tyler Morrow


This blog post contains the following powershell script which can be run on your source control folder and will remove the source control bindings from the files:

# Remove unnecessary files  
get-childitem . -include *.vssscc,*.user,*.vspscc,*.pdb,Debug -recurse |   
%{   
    remove-item $_.fullname -force -recurse   
}  

# Remove the bindings from the sln files  
get-childitem . -include *.sln -recurse |   
%{   
    $file = $_;   
    $inVCSection = $False;  
    get-content $file |   
    %{   
        $line = $_.Trim();   
        if ($inVCSection -eq $False -and $line.StartsWith('GlobalSection') -eq $True -and $line.Contains('VersionControl') -eq $True) {   
            $inVCSection = $True   
        }   
        if ($inVCSection -eq $False) {   
            add-content ($file.fullname + '.new') $_   
        }   
        if ($inVCSection -eq $True -and $line -eq 'EndGlobalSection') {   
            $inVCSection = $False  
        }  
    }  
    mv ($file.fullname + '.new') $file.fullname -force   
}  

# Remove the bindings from the csproj files  
get-childitem . -include *.csproj -recurse |   
%{   
    $file = $_;   
    get-content $file |   
    %{   
        $line = $_.Trim();   
        if ($line.StartsWith('<Scc') -eq $False) {  
            add-content ($file.fullname + '.new') $_   
        }  
    }  
    mv ($file.fullname + '.new') $file.fullname -force   

}
like image 43
d4nt Avatar answered Oct 10 '22 13:10

d4nt