-
Notifications
You must be signed in to change notification settings - Fork 5
/
setreferencecopylocal.ps1
38 lines (34 loc) · 1.87 KB
/
setreferencecopylocal.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
# Copyright RHEA System S.A.
# A powershell script that is used to make sure that on the plugin projects the CDP4Common nuget is not copied to local
# this script needs to be run after CDP4Common nuget has been updated
dir -Recurse *.csproj | `
ForEach-Object { $projectpath = $_.FullName;
if (($projectpath -notlike '*CDP4IME*') -and ($projectpath -notlike '*.Tests*'))
{
$xml = [xml](Get-Content $_)
$references = $xml.Project.ItemGroup | Where-Object { $_.Reference -ne $null }
foreach($reference in $references.ChildNodes)
{
if (($reference.Include -like '*CDP4RequirementsVerification*') -or ($reference.Include -like '*CDP4Common*') -or ($reference.Include -like '*CDP4JsonSerializer*') -or ($reference.Include -like '*CDP4Dal*') -or ($reference.Include -like '*Microsoft.Practices.ServiceLocation*') -or ($reference.Include -like '*NLog*') -or ($reference.Include -like '*Newtonsoft.Json*') -or ($reference.Include -like '*DevExpress*'))
{
if($reference.Private -eq $null)
{
[System.Xml.XmlElement]$copyLocal = $xml.CreateElement("Private", "http://schemas.microsoft.com/developer/msbuild/2003")
$copyLocal.InnerText = "False"
[Void]$reference.AppendChild($copyLocal)
$xml.save($projectpath)
write-Host $projectpath
}
else
{
if ($reference.Private -eq "True")
{
$reference.Private = "False"
$xml.save($projectpath)
write-Host $projectpath
}
}
}
}
}
}