-
Notifications
You must be signed in to change notification settings - Fork 0
/
RemoveFromTfs.ps1
41 lines (38 loc) · 1.21 KB
/
RemoveFromTfs.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# 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
}