-Build
This commit is contained in:
@@ -82,7 +82,6 @@ task Build -depends Clean {
|
|||||||
robocopy $sourceDir $workingSourceDir /MIR /NFL /NDL /NP /XD bin obj TestResults AppPackages $packageDirs .vs artifacts /XF *.suo *.user *.lock.json | Out-Default
|
robocopy $sourceDir $workingSourceDir /MIR /NFL /NDL /NP /XD bin obj TestResults AppPackages $packageDirs .vs artifacts /XF *.suo *.user *.lock.json | Out-Default
|
||||||
Copy-Item -Path $baseDir\LICENSE.md -Destination $workingDir\
|
Copy-Item -Path $baseDir\LICENSE.md -Destination $workingDir\
|
||||||
mkdir "$workingDir\Build" -Force
|
mkdir "$workingDir\Build" -Force
|
||||||
Copy-Item -Path $buildDir\install.ps1 -Destination $workingDir\Build\
|
|
||||||
|
|
||||||
$xml = [xml](Get-Content "$workingSourceDir\Newtonsoft.Json\Newtonsoft.Json.csproj")
|
$xml = [xml](Get-Content "$workingSourceDir\Newtonsoft.Json\Newtonsoft.Json.csproj")
|
||||||
Edit-XmlNodes -doc $xml -xpath "/Project/PropertyGroup/PackageId" -value $packageId
|
Edit-XmlNodes -doc $xml -xpath "/Project/PropertyGroup/PackageId" -value $packageId
|
||||||
|
|||||||
@@ -1,116 +0,0 @@
|
|||||||
param($installPath, $toolsPath, $package, $project)
|
|
||||||
|
|
||||||
# open json.net splash page on package install
|
|
||||||
# don't open if json.net is installed as a dependency
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$url = "http://www.newtonsoft.com/json/install?version=" + $package.Version
|
|
||||||
$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) | Out-Null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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 "=============================="
|
|
||||||
|
|
||||||
$lastOperation = $operations | select -last 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) | Out-Null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$pmPane = $dte2.ToolWindows.OutputWindow.OutputWindowPanes.Item("Package Manager")
|
|
||||||
|
|
||||||
$selection = $pmPane.TextDocument.Selection
|
|
||||||
$selection.StartOfDocument($false)
|
|
||||||
$selection.EndOfDocument($true)
|
|
||||||
|
|
||||||
if ($selection.Text.StartsWith("Attempting to gather dependencies information for package 'Newtonsoft.Json." + $package.Version + "'"))
|
|
||||||
{
|
|
||||||
# don't show on upgrade
|
|
||||||
if (!$selection.Text.Contains("Removed package"))
|
|
||||||
{
|
|
||||||
$dte2.ItemOperations.Navigate($url) | Out-Null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
# stop potential errors from bubbling up
|
|
||||||
# worst case the splash page won't open
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# still yolo
|
|
||||||
@@ -31,7 +31,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Remove="**\*.orig" />
|
<None Remove="**\*.orig" />
|
||||||
<None Include="..\..\LICENSE.md" Pack="true" PackagePath="LICENSE.md" />
|
<None Include="..\..\LICENSE.md" Pack="true" PackagePath="LICENSE.md" />
|
||||||
<None Include="..\..\Build\install.ps1" Pack="true" PackagePath="tools\install.ps1" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Condition="'$(TargetFramework)'=='net45'">
|
<PropertyGroup Condition="'$(TargetFramework)'=='net45'">
|
||||||
<AssemblyTitle>Json.NET</AssemblyTitle>
|
<AssemblyTitle>Json.NET</AssemblyTitle>
|
||||||
|
|||||||
Reference in New Issue
Block a user