从TFS获取未绑定的解决方案

Tra*_*rks 9 tfs export unbind

我有一个开源项目,我想打包成一个包含二进制文件和源代码的.zip文件.该项目托管在CodePlex上,并使用TFS作为源代码控制.我不知道如何导出项目以删除所有源代码控制绑定.这样人们就可以轻松地在本地打开解决方案,而无需获得登录提示.此功能在Git中称为Export,但我不确定如何在Team中执行相同的操作.

d4n*_*4nt 11

此博客文章包含以下powershell脚本,该脚本可以在源控制文件夹上运行,并将从文件中删除源代码控制绑定:

# 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   

}
Run Code Online (Sandbox Code Playgroud)


Dan*_*zey 5

源控件绑定信息是VS Project和Solution文件的一部分,很难删除.但是,我知道有两种选择:

如果您"获取"项目,将源文件夹复制/移动到其他位置,然后重新打开解决方案,VS将提供删除源控件绑定.

或者,要在此处执行此操作,可以在VS中打开源控制的解决方案,然后单击"文件/源代码管理/更改源代码管理".该对话框有一个"解除绑定"按钮,可以删除每个项目的绑定.

(警告:在VS2010上测试过;不确定您使用的是哪个版本.)