-
Notifications
You must be signed in to change notification settings - Fork 12
/
update_dependencies.ps1
24 lines (20 loc) · 1.02 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", "Axodox.MachineLearning")
$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\.\d+(\.\d+)+\\", ("\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[@id = '$dependency']")
foreach ($dependencyNode in $dependencyNodes) {
$dependencyNode.version = $latestVersion
}
$configContent.Save($configPath)
}
}