question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dotnet-install should return structured (xml, json) output

See original GitHub issue

Steps to reproduce

the following PS-Call

.\dotnet-install.ps1 -Version latest -Channel master -DryRun

returns:

dotnet-install: Payload URLs:
dotnet-install: - https://dotnetcli.azureedge.net/dotnet/Sdk/2.0.0-preview1-005807/dotnet-dev-win-x64.2.0.0-preview1-005807.zip
dotnet-install: Repeatable invocation: .\dotnet-install.ps1 -Version 2.0.0-preview1-005807 -Channel master -Architecture x64 -InstallDir <auto>

Actual behavior

dotnet-install “calculates” the latest available version.

in this case “2.0.0-preview1-005807” is returned for “latest”

the output is readable for humans but not for programs…

intent: dotnet-install currently seems to be the only “official” API do read data from the “dotnet deployment system”

Expected behavior

for automation purposes we need a mechanism to return the output in a better structured/formatted way like Xml, Json, Hashtable, at least without any comments and surrounding text.

.\dotnet-install.ps1 -Version latest -Channel master -DryRun -ReturnAsHashtable can return:

@{
SpecificVersion = ''2.0.0-preview1-005807"
Channel = "master"
Architecture = "x64"
InstallDir = "<auto>"
}

i’m specially interested on the value for “SpecificVersion” because it is calculated inside “dotnet-install” ! alternative idea: reorganize the script so that it can be dot sourced AND the functions inside are public available/documented

regards Werner Mairl

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
WernerMairlcommented, Apr 27, 2017

a) i understand your points b) i have a workaround for now (parsing the output), and i see some option for me (including a refactoring of “dotnet-install.ps1” into a reusable module for this purpose…

c) feel free to close this issue

thank you all!

Werner

0reactions
wli3commented, Apr 26, 2017

@WernerMairl

If this script can print a json to console. It is still not reliable since the down stream console app need to parse and “look for” the json. In this case, it will not be easier or more reliable than parse current format by awk. The “right way” might be .\dotnet-install.ps1 -Version latest -Channel master -DryRun -ReturnAsHashtable -OutputRepeatableInvocation:json and only RepeatableInvocation is printed. However, this will require a lot work. And I don’t think this issue have enough attraction yet to gain a high probity.

Could you try to pipe to awk or similar console app for now?

Read more comments on GitHub >

github_iconTop Results From Across the Web

ASP.NET Core .NET 6 app returning XML instead of JSON ...
Our app returns 99% of the results in JSON, but has a specific SOAP endpoint that returns XML (it communicates with another SOAP...
Read more >
XML + JSON Output for Web APIs in ASP .NET Core 3.1
Returning JsonResult and IActionResult​​ Before we get into XML output for your Web API, let's start off with JSON output first, and then...
Read more >
Returning XML from minimal APIs in .NET 6
In this post I show how to return an XML response from minimal APIs, how to create a helper extension method, and discuss...
Read more >
How to Convert JSON to XML or XML to JSON in C# - ...
Demonstrate how to convert JSON to XML back and forth using System.Text.Json and Newtonsoft.Json with detail explanation and examples.
Read more >
Azure Data Factory - Converting XML Response to JSON
I am calling a webservice and storing the response in a text file. I have noticed that ADF will convert an XML response...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found