Skip to content

Update tools.ps1 GUID creation#15123

Merged
MiYanni merged 1 commit intomainfrom
MiYanni-patch-1
Oct 2, 2024
Merged

Update tools.ps1 GUID creation#15123
MiYanni merged 1 commit intomainfrom
MiYanni-patch-1

Conversation

@MiYanni
Copy link
Member

@MiYanni MiYanni commented Oct 1, 2024

Summary

The cmdlet New-Guid only exists in PowerShell Core version 5 and greater. If you want to run the tools.ps1 script in Windows PowerShell, it will error with something similar to this:

  C:\Code\workload-versions\eng\download-workloads.ps1 : The term 'New-Guid' is not recognized as
  the name of a cmdlet, function, script file, or operable program. Check the spelling of the name,
  or if a path was included, verify that the path is correct and try again.
  At line:1 char:1
  + . C:\Code\workload-versions\eng\download-workloads.ps1 -workloadOutpu ...
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : ObjectNotFound: (New-Guid:String) [download-workloads.ps1], CommandN
     otFoundException
      + FullyQualifiedErrorId : CommandNotFoundException,download-workloads.ps1

To fix this problem, we instead just call the NewGuid() method directly, which works on both PowerShell Core and Windows PowerShell.

Other Actions

I'll need this functionality backported to the .NET 8 branch as well.

@MiYanni MiYanni merged commit 121ea59 into main Oct 2, 2024
@MiYanni MiYanni deleted the MiYanni-patch-1 branch October 2, 2024 01:50
@MiYanni
Copy link
Member Author

MiYanni commented Oct 2, 2024

/backport to release/8.0

@MiYanni
Copy link
Member Author

MiYanni commented Oct 2, 2024

/backport to release/9.0

@github-actions
Copy link
Contributor

github-actions bot commented Oct 2, 2024

@github-actions
Copy link
Contributor

github-actions bot commented Oct 2, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants