{
    "id": "d8cb5786-a111-439e-901d-355062b2941e",
    "name": "MongoDbSync",
    "friendlyName": "MongoDbSync",
    "description": "Synchronisation MongoDb tool",
    "helpMarkDown": "",
    "category": "Deploy",
    "visibility": [
        "Build",
        "Release"
    ],
    "author": "Cédric Michel",
    "version": {
        "Major": 1,
        "Minor": 0,
        "Patch": 0
    },  
    "groups": [
        {
            "name": "MongoDbSync",
            "displayName": "MongoDbSync",
            "isExpanded": false
        }
    ],
    "inputs": [       
        {
            "name": "parameter",
            "type": "string",
            "label": "Parameter to launch the Synchronisation MongoDb tool",
            "defaultValue": "-q -f",
            "required": true,
            "helpMarkDown": "Parameter send to tool"
        }  
            
    ],
    "execution": {
        "PowerShell3": {
            "target": "tool.ps1",
            "argumentFormat": ""            
        }
    }
}


 
{
  "manifestVersion": 1,
  "id": "build-release-task",
  "name": "MongoDbSync",
  "version": "1.0.2",
  "publisher": "cedric-michel",
  "targets": [
    {
      "id": "Microsoft.VisualStudio.Services"
    }
  ],
  "content": {
    "details": {
      "path": "overview.md"
    }
  },
  "links": {
    "getstarted": {
      "uri": "https://github.com/michelcedric/MongoDbSynchronisation"
    }
  },
  "repository": {
    "type": "git",
    "uri": "https://github.com/michelcedric/MongoDbSynchronisation"
  },
  "description": "Synchronisation MongoDb tool",
  "categories": [
    "Azure Pipelines"
  ],
  "icons": {
    "default": "images/extension-icon.png"
  },
  "files": [
    {
      "path": "buildAndReleaseTask"
    }
  ],
  "contributions": [
    {
      "id": "custom-build-release-task",
      "type": "ms.vss-distributed-task.task",
      "targets": [
        "ms.vss-distributed-task.tasks"
      ],
      "properties": {
        "name": "buildAndReleaseTask"
      }
    }
  ]
}



"inputs": [       
        {
            "name": "parameter",
            "type": "string",
            "label": "Parameter to launch the Synchronisation MongoDb tool",
            "defaultValue": "-q -f",
            "required": true,
            "helpMarkDown": "Parameter send to tool"
        }  




[CmdletBinding()]
param()
Trace-VstsEnteringInvocation $MyInvocation

try
{
	Write-Host "... Powershell Starting ..."

	$parameter = Get-VstsInput -Name parameter -Require

	Write-Host "Parameter : $($parameter)"

	$exeFileName = "tool/MongoSync.exe"
	$exeFilePath  = Join-Path $PSScriptRoot $exeFileName 

	$pinfo = New-Object System.Diagnostics.ProcessStartInfo 
	$pinfo.FileName = $exeFilePath
	$pinfo.Arguments = $parameter
	$pinfo.UseShellExecute = $false 
	$pinfo.CreateNoWindow = $true 
	$pinfo.RedirectStandardOutput = $true 
	$pinfo.RedirectStandardError = $true

	$process= New-Object System.Diagnostics.Process 
	$process.StartInfo = $pinfo
	$process.Start() | Out-Null 
	$process.WaitForExit()


	$stdout = $process.StandardOutput.ReadToEnd();

	Write-Host $stdout 

	Write-Host "... Powershell Step finished ..."

}finally{
	 Trace-VstsLeavingInvocation $MyInvocation
}