-Fixed potential inifinite loop when parsing unquoted value
-Added NuGet install.ps1 -Incremented version to 5.0.6
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>Newtonsoft.Json</id>
|
||||
<version>5.0.5</version>
|
||||
<version>5.0.6</version>
|
||||
<title>Json.NET</title>
|
||||
<description>Json.NET is a popular high-performance JSON framework for .NET</description>
|
||||
<authors>James Newton-King</authors>
|
||||
|
||||
+9
-5
@@ -1,12 +1,12 @@
|
||||
properties {
|
||||
$zipFileName = "Json50r5.zip"
|
||||
$zipFileName = "Json50r6.zip"
|
||||
$majorVersion = "4.5"
|
||||
$majorWithReleaseVersion = "5.0.5"
|
||||
$majorWithReleaseVersion = "5.0.6"
|
||||
$version = GetVersion $majorWithReleaseVersion
|
||||
$signAssemblies = $false
|
||||
$signKeyPath = "D:\Development\Releases\newtonsoft.snk"
|
||||
$buildDocumentation = $false
|
||||
$buildNuGet = $false
|
||||
$buildNuGet = $true
|
||||
$treatWarningsAsErrors = $false
|
||||
|
||||
$baseDir = resolve-path ..
|
||||
@@ -17,7 +17,7 @@
|
||||
$releaseDir = "$baseDir\Release"
|
||||
$workingDir = "$baseDir\Working"
|
||||
$builds = @(
|
||||
@{Name = "Newtonsoft.Json"; TestsName = "Newtonsoft.Json.Tests"; Constants=""; FinalDir="Net45"; NuGetDir = "net45"; Framework="net-4.0"; Sign=$true},
|
||||
@{Name = "Newtonsoft.Json"; TestsName = "Newtonsoft.Json.Tests"; Constants=""; FinalDir="Net45"; NuGetDir = "net45"; Framework="net-4.0"; Sign=$true}
|
||||
@{Name = "Newtonsoft.Json.Portable"; TestsName = "Newtonsoft.Json.Tests.Portable"; Constants="PORTABLE"; FinalDir="Portable"; NuGetDir = "portable-net45+wp80+win8"; Framework="net-4.0"; Sign=$true},
|
||||
@{Name = "Newtonsoft.Json.Portable40"; TestsName = "Newtonsoft.Json.Tests.Portable40"; Constants="PORTABLE40"; FinalDir="Portable40"; NuGetDir = "portable-net40+sl4+wp7+win8"; Framework="net-4.0"; Sign=$true},
|
||||
@{Name = "Newtonsoft.Json.WinRT"; TestsName = $null; Constants="NETFX_CORE"; FinalDir="WinRT"; NuGetDir = "netcore45"; Framework="net-4.5"; Sign=$true},
|
||||
@@ -77,11 +77,15 @@ task Package -depends Build {
|
||||
if ($buildNuGet)
|
||||
{
|
||||
New-Item -Path $workingDir\NuGet -ItemType Directory
|
||||
New-Item -Path $workingDir\NuGet\tools -ItemType Directory
|
||||
|
||||
Copy-Item -Path "$buildDir\Newtonsoft.Json.nuspec" -Destination $workingDir\NuGet\Newtonsoft.Json.nuspec -recurse
|
||||
|
||||
Copy-Item -Path "$buildDir\install.ps1" -Destination $workingDir\NuGet\tools\install.ps1 -recurse
|
||||
|
||||
foreach ($build in $builds)
|
||||
{
|
||||
if ($build.NuGetDir -ne $null)
|
||||
if ($build.NuGetDir)
|
||||
{
|
||||
$name = $build.TestsName
|
||||
$finalDir = $build.FinalDir
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
param($installPath, $toolsPath, $package, $project)
|
||||
|
||||
# yolo
|
||||
|
||||
try
|
||||
{
|
||||
$url = "http://www.json.net"
|
||||
$dte2 = Get-Interface $dte ([EnvDTE80.DTE2])
|
||||
|
||||
if ($dte2.ActiveWindow.Caption -eq "Package Manager Console")
|
||||
{
|
||||
# user is installing from VS NuGet console
|
||||
# get reference to the window, the console host and the input history
|
||||
# show webpage if "install-package newtonsoft.json" was last input
|
||||
|
||||
$consoleWindow = $(Get-VSComponentModel).GetService([NuGetConsole.IPowerConsoleWindow])
|
||||
|
||||
$props = $consoleWindow.GetType().GetProperties([System.Reflection.BindingFlags]::Instance -bor `
|
||||
[System.Reflection.BindingFlags]::NonPublic)
|
||||
|
||||
$prop = $props | ? { $_.Name -eq "ActiveHostInfo" } | select -first 1
|
||||
if ($prop -eq $null) { return }
|
||||
|
||||
$hostInfo = $prop.GetValue($consoleWindow)
|
||||
if ($hostInfo -eq $null) { return }
|
||||
|
||||
$history = $hostInfo.WpfConsole.InputHistory.History
|
||||
|
||||
$lastCommand = $history | select -last 1
|
||||
|
||||
if ($lastCommand)
|
||||
{
|
||||
$lastCommand = $lastCommand.Trim().ToLower()
|
||||
if ($lastCommand.StartsWith("install-package") -and $lastCommand.Contains("newtonsoft.json"))
|
||||
{
|
||||
$dte2.ItemOperations.Navigate($url)
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
# user is installing from VS NuGet dialog
|
||||
# get reference to the window, then smart output console provider
|
||||
# show webpage if messages in buffered console contains "installing...newtonsoft.json" in last operation
|
||||
|
||||
$instanceField = [NuGet.Dialog.PackageManagerWindow].GetField("CurrentInstance", [System.Reflection.BindingFlags]::Static -bor `
|
||||
[System.Reflection.BindingFlags]::NonPublic)
|
||||
$consoleField = [NuGet.Dialog.PackageManagerWindow].GetField("_smartOutputConsoleProvider", [System.Reflection.BindingFlags]::Instance -bor `
|
||||
[System.Reflection.BindingFlags]::NonPublic)
|
||||
if ($instanceField -eq $null -or $consoleField -eq $null) { return }
|
||||
|
||||
$instance = $instanceField.GetValue($null)
|
||||
if ($instance -eq $null) { return }
|
||||
|
||||
$consoleProvider = $consoleField.GetValue($instance)
|
||||
if ($consoleProvider -eq $null) { return }
|
||||
|
||||
$console = $consoleProvider.CreateOutputConsole($false)
|
||||
|
||||
$messagesField = $console.GetType().GetField("_messages", [System.Reflection.BindingFlags]::Instance -bor `
|
||||
[System.Reflection.BindingFlags]::NonPublic)
|
||||
if ($messagesField -eq $null) { return }
|
||||
|
||||
$messages = $messagesField.GetValue($console)
|
||||
if ($messages -eq $null) { return }
|
||||
|
||||
$operations = $messages -split "=============================="
|
||||
|
||||
# second to last
|
||||
$lastOperation = $operations | select -last 2 | select -first 1
|
||||
|
||||
if ($lastOperation)
|
||||
{
|
||||
$lastOperation = $lastOperation.ToLower()
|
||||
|
||||
$lines = $lastOperation -split "`r`n"
|
||||
|
||||
$installMatch = $lines | ? { $_.StartsWith("------- installing...newtonsoft.json") } | select -first 1
|
||||
|
||||
if ($installMatch)
|
||||
{
|
||||
$dte2.ItemOperations.Navigate($url)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
# prevent potental errors from bubbling up
|
||||
}
|
||||
Reference in New Issue
Block a user