0

I am new to Powershell 7

I have a .txt log file formatted like this:

Include Version
Microsoft.ApplicationInsights 2.17.0
NewtonSoft.Json 13.0.1

I need to iterate and read the package names and versions of this file and somehow insert the values into something like this:

dotnet package add {packagename} --version {version}

Any guidance on the best approach would be greatly appreciated.

Thanks.

1 Answer 1

0

A while ago, I wrote a cmdlet ConvertFrom-SourceTable that can read a lot of (aligned) data tables including the ones from StackOverflow, see New Feature: Table Support:

$Table = '
|Include                       |Version|
|------------------------------|-------|
|Microsoft.ApplicationInsights |2.17.0 |
|NewtonSoft.Json               |13.0.1 |'

$Table | ConvertFrom-SourceTable

Include                       Version
-------                       -------
Microsoft.ApplicationInsights 2.17.0
NewtonSoft.Json               13.0.1
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.