diff --git a/src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj b/src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj index 7f0bb98cc6b..e9d84f44181 100644 --- a/src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj +++ b/src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj @@ -68,7 +68,7 @@ - + diff --git a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj index 33741706393..f2eef2f0ee9 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj +++ b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj @@ -77,7 +77,7 @@ - + diff --git a/src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj b/src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj index e222112cfb6..9d57e79f8d0 100644 --- a/src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj +++ b/src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj @@ -23,7 +23,7 @@ - + diff --git a/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj b/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj index 31187624128..83af547524f 100644 --- a/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj +++ b/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj @@ -15,17 +15,17 @@ - - + + - - - - - + + + + + - + diff --git a/src/Microsoft.WSMan.Management/Microsoft.WSMan.Management.csproj b/src/Microsoft.WSMan.Management/Microsoft.WSMan.Management.csproj index 1d4f4e581b6..0bcb669ff9e 100644 --- a/src/Microsoft.WSMan.Management/Microsoft.WSMan.Management.csproj +++ b/src/Microsoft.WSMan.Management/Microsoft.WSMan.Management.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/System.Management.Automation/System.Management.Automation.csproj b/src/System.Management.Automation/System.Management.Automation.csproj index 67fc45727cb..aa6ffbb9785 100644 --- a/src/System.Management.Automation/System.Management.Automation.csproj +++ b/src/System.Management.Automation/System.Management.Automation.csproj @@ -11,9 +11,9 @@ - + - + diff --git a/test/csharp/csharp.tests.csproj b/test/csharp/csharp.tests.csproj index 6ecf16d2a44..dcd35236b3a 100644 --- a/test/csharp/csharp.tests.csproj +++ b/test/csharp/csharp.tests.csproj @@ -21,9 +21,9 @@ - + - + diff --git a/test/tools/WebListener/WebListener.csproj b/test/tools/WebListener/WebListener.csproj index 9ee1d8298ac..b688faa33f7 100644 --- a/test/tools/WebListener/WebListener.csproj +++ b/test/tools/WebListener/WebListener.csproj @@ -7,7 +7,7 @@ - + diff --git a/tools/releaseTools.psm1 b/tools/releaseTools.psm1 index 206faa95d3f..1f05c44f395 100644 --- a/tools/releaseTools.psm1 +++ b/tools/releaseTools.psm1 @@ -189,4 +189,61 @@ function Get-ChangeLog $new_commits | Sort-Object -Descending -Property IsBreakingChange | ForEach-Object -MemberName ChangeLogMessage } -Export-ModuleMember -Function Get-ChangeLog +############################## +#.SYNOPSIS +#Gets packages which have newer packages in nuget.org +# +#.PARAMETER Path +#The path to check for csproj files with packagse +# +#.OUTPUTS +#Objects which represet the csproj package ref, with the current and new version +############################## +function Get-NewOfficalPackage +{ + param( + [String] + $Path = (Join-path -Path $PSScriptRoot -ChildPath '..') + ) + # Calculate the filter to find the CSProj files + $filter = Join-Path -Path $Path -ChildPath '*.csproj' + $csproj = Get-ChildItem $filter -Recurse + + $csproj | ForEach-Object{ + $file = $_ + + # parse the csproj + [xml] $csprojXml = (Get-content -Raw -Path $_) + + # get the package references + $packages=$csprojXml.Project.ItemGroup.PackageReference + + # check to see if there is a newer package for each refernce + foreach($package in $packages) + { + # Get the name of the package + $name = $package.Include + + # don't pull 'Microsoft.Management.Infrastructure' from nuget + if($name -and $name -ne 'Microsoft.Management.Infrastructure') + { + # Get the current package from nuget + $newPackage = find-package -Name $name -Source https://nuget.org/api/v2/ -ErrorAction SilentlyContinue + + # If the current package has a different version from the version in the csproj, print the details + if($newPackage -and $newPackage.Version.ToString() -ne $package.version) + { + [pscustomobject]@{ + Csproj = $file + PackageName = $name + CsProjVersion = $Package.Version + NuGetVersion = $newPackage.Version + } + } + } + } + } +} + + +Export-ModuleMember -Function Get-ChangeLog, Get-NewOfficalPackage