Home > database >  Is it Possible to Check-in a DLL When Creating a Branch through Azure Dev Ops API Call?
Is it Possible to Check-in a DLL When Creating a Branch through Azure Dev Ops API Call?

Time:02-02

I'm wondering if the following is possible is any form. I'm following along with this document: enter image description here

Is there any way either through this API Call or through PowerShell for me to commit a DLL into the new branch that I am creating? Thanks in advance!

CodePudding user response:

Read the raw bytes from disk then convert to Base64:

# locate file
$dllFile = Get-Item .\path\to\dll
# open file stream to read file contents
$fileStream = $dllFile.OpenRead()

try {
  # read file contents into buffer
  $buffer = [byte[]]::new($dllFile.Length)
  $readCount = $fileStream.Read($buffer, 0, $dllFile.Length)

  # convert file contents to base64 string
  $base64EncodedDLL = [Convert]::ToBase64String($buffer, 0, $readCount)
}
finally {
  # clean up file stream handle
  $fileStream.Dispose()
}

Now you simply pass the string value stored in $base64EncodedDLL as the content property and set the contentType to "base64encoded"

  •  Tags:  
  • Related