-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremoveCopyLocal.ps1
More file actions
81 lines (68 loc) · 2.7 KB
/
Copy pathremoveCopyLocal.ps1
File metadata and controls
81 lines (68 loc) · 2.7 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
clear
$projects = Get-ChildItem -Include "*.csproj" -Path C:\BOG\aims\Dev -Recurse
#copiar los archivos con otro nombre
foreach($project in $projects)
{
# $tf = &"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\tf.exe" checkout $project
#$tf | Out-null
$project.Attributes = 'Normal'
$xml = [xml](Get-Content $project)
$xmlns = "http://schemas.microsoft.com/developer/msbuild/2003"
# $xml.Data.Course.Subject
$references = $xml.Project.ItemGroup.Reference | where{($_.Private -eq "True" -or ($_.HintPath -ne "" -and -not $_.Private ))}
if ($references -ne $null)
{
Write-Output $project.FullName | Format-Table -AutoSize
foreach($reference in $references)
{
Write-Output $reference | Format-Table
if($reference -ne $null -and -not $reference.Private)
{
$privateProp = $xml.CreateElement('Private',$xmlns)
$privateProp.InnerXML = "False"
$reference.AppendChild($privateProp)
}
elseif ($reference -ne $null -and $reference.Private -ne $null)
{
$reference.Private = "False"
}
}
}
$projectreferences = $xml.Project.ItemGroup.ProjectReference | where{($_.Private -eq "True" -or ( -not $_.Private ))}
if ($projectreferences -ne $null)
{
Write-Output $project.FullName | Format-Table -AutoSize
foreach($reference in $projectreferences)
{
Write-Output $reference | Format-Table
if($reference -ne $null -and -not $reference.Private)
{
$privateProp = $xml.CreateElement('Private',$xmlns)
$privateProp.InnerXML = "False"
$reference.AppendChild($privateProp)
}
elseif ($reference -ne $null -and $reference.Private -ne $null)
{
$reference.Private = "False"
}
}
}
$xml.Save($project)
#$node = $xml.Project.ItemGroup.None | Where {($_.Include -eq "Properties\PublishProfiles\Development.pubxml") }
# $parent=$node.ParentNode
# $newfile = $xml.CreateElement('None',$xmlns)
# $newfile.SetAttribute('Include',"Properties\PublishProfiles\DevelopmentLin.pubxml")
# $parent.AppendChild($newfile)
#
# $newnode = $xml.CreateElement('None',$xmlns)
# $newnode.SetAttribute('Include',"Web.DevelopmentLin.config")
#
# $newchildnode = $xml.CreateElement('DependentUpon',$xmlns)
# $newchildnode.InnerXML = "Web.config"
# $newnode.AppendChild($newchildnode)
#
# $newnode | fc
#
# $parent.AppendChild($newnode)
# $parent |fc
}