This repository was archived by the owner on Nov 27, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathRemoveTFSBindings.ps1
More file actions
50 lines (38 loc) · 1.52 KB
/
RemoveTFSBindings.ps1
File metadata and controls
50 lines (38 loc) · 1.52 KB
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
42
43
44
45
46
47
48
49
# Convert *.sln files
foreach ($solution in gci -include *.sln -recurse)
{
$file = [System.IO.File]::OpenText($Solution)
$newSolutionFile = @()
while (!$file.EndOfStream)
{
$line =$file.ReadLine()
if ($line -match '^\s+GlobalSection\(TeamFoundationVersionControl\)')
{
Write-Host "Found a solution with TFS bindings in" $Solution.FullName
Write-Host "Converting..."
while ($line -notmatch '^\s+EndGlobalSection')
{
$line = $file.ReadLine()
}
$line = $file.ReadLine()
}
$newSolutionFile = $newSolutionFile + $line
}
$file.Close()
$newSolutionFile | out-file -force -encoding ASCII ($solution.FullName)
}
# Convert *.csproj files
foreach ($project in gci -include *.csproj -recurse)
{
Write-Host "Found a C# project file with TFS bindings in" $project.FullName
Write-Host "Converting..."
Set-ItemProperty $project -name IsReadOnly -Value $false
$xml = [xml] (Get-Content $project)
$xml | Select-Xml -Xpath "//*[local-name() = 'SccProjectName']" | foreach {$_.Node.ParentNode.RemoveChild($_.Node)} | Out-null
$xml | Select-Xml -Xpath "//*[local-name() = 'SccLocalPath']" | foreach {$_.Node.ParentNode.RemoveChild($_.Node)} | Out-Null
$xml | Select-Xml -Xpath "//*[local-name() = 'SccAuxPath']" | foreach {$_.Node.ParentNode.RemoveChild($_.Node)} | Out-Null
$xml | Select-Xml -Xpath "//*[local-name() = 'SccProvider']" | foreach {$_.Node.ParentNode.RemoveChild($_.Node)} | Out-Null
$xml.Save($project)
}
# Remove all extra binding files
gci -include *.vs?scc -recurse | Remove-Item -force