-
Notifications
You must be signed in to change notification settings - Fork 35
/
update_dependencies.ps1
24 lines (20 loc) · 1 KB
/
update_dependencies.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
$dependencies = @("Axodox.Common")
$pluginProjects = Resolve-Path "./*/*.vcxproj"
foreach ($dependency in $dependencies) {
$latestPackage = .\Tools\nuget.exe list -allversions $dependency
$latestVersion = [regex]::Match($latestPackage, "\d+(\.\d+)+").Value
foreach ($projectPath in $pluginProjects) {
# Update project file
$projectContent = Get-Content -Path $projectPath -Raw
$projectContent = $projectContent -replace "\\packages\\$dependency\.([^\\]+)\\", ("\packages\$dependency.$1" + $latestVersion + '\')
Set-Content -Path $projectPath -Value $projectContent -NoNewline
# Update packages.config
$configPath = Join-Path (Split-Path $projectPath) 'packages.config'
$configContent = [xml](Get-Content -Path $configPath)
$dependencyNodes = $configContent.SelectNodes("//package[contains(@id, '$dependency')]")
foreach ($dependencyNode in $dependencyNodes) {
$dependencyNode.version = $latestVersion
}
$configContent.Save($configPath)
}
}