If you set the Package.Alias before the package has been saved using Update(), the alias doesn't stick.
You have to first Update() the package and only after that setting the Alias has any effect.
Steps to Reproduce:
- Execute the script below
- Notice that the first line of the output reads "Alias before update: ''" where it should read Alias before update: 'Alias before update'
sub main
dim package as EA.Package
set package = Repository.GetTreeSelectedPackage
dim newPackage as EA.Package
set newPackage = package.Packages.AddNew("NewPackage","")
newPackage.Alias = "Set Before update"
Session.Output "Alias before update: '" & newPackage.Alias & "'"
newPackage.Update
newPackage.Alias = "Set after update"
Session.Output "Alias after first update: '" & newPackage.Alias & "'"
newPackage.Update
Session.Output "Alias after second update: '" & newPackage.Alias & "'"
end sub
main
Reported
Geert