diff --git a/src/NetDaemon.Templates.Project/templates/netdaemon/update_all_dependencies.ps1 b/src/NetDaemon.Templates.Project/templates/netdaemon/update_all_dependencies.ps1 new file mode 100644 index 0000000..2cf81b8 --- /dev/null +++ b/src/NetDaemon.Templates.Project/templates/netdaemon/update_all_dependencies.ps1 @@ -0,0 +1,19 @@ +# Update the codegen +dotnet tool update joysoftware.netdaemon.hassmodel.codegen + +# Update all nugets to latest versions +$regex = 'PackageReference Include="([^"]*)" Version="([^"]*)"' + +ForEach ($file in get-childitem . -recurse | where { $_.extension -like "*proj" }) { + $packages = Get-Content $file.FullName | + select-string -pattern $regex -AllMatches | + ForEach-Object { $_.Matches } | + ForEach-Object { $_.Groups[1].Value.ToString() } | + sort -Unique + + ForEach ($package in $packages) { + write-host "Update $file package :$package" -foreground 'magenta' + $fullName = $file.FullName + iex "dotnet add $fullName package $package" + } +} \ No newline at end of file diff --git a/src/NetDaemon.Templates.Project/templates/netdaemon_src/update_all_dependencies.ps1 b/src/NetDaemon.Templates.Project/templates/netdaemon_src/update_all_dependencies.ps1 new file mode 100644 index 0000000..2cf81b8 --- /dev/null +++ b/src/NetDaemon.Templates.Project/templates/netdaemon_src/update_all_dependencies.ps1 @@ -0,0 +1,19 @@ +# Update the codegen +dotnet tool update joysoftware.netdaemon.hassmodel.codegen + +# Update all nugets to latest versions +$regex = 'PackageReference Include="([^"]*)" Version="([^"]*)"' + +ForEach ($file in get-childitem . -recurse | where { $_.extension -like "*proj" }) { + $packages = Get-Content $file.FullName | + select-string -pattern $regex -AllMatches | + ForEach-Object { $_.Matches } | + ForEach-Object { $_.Groups[1].Value.ToString() } | + sort -Unique + + ForEach ($package in $packages) { + write-host "Update $file package :$package" -foreground 'magenta' + $fullName = $file.FullName + iex "dotnet add $fullName package $package" + } +} \ No newline at end of file