I'm just now starting to look into the many changes that DNN 5 brings to the various entity classes relating to module definitions, desktop modules, etc. so have not yet tried this but can see from the source that the Version property of the ModuleInfo class has been marked as Obsolete. I am surprised, however, that it still does not return the version since it now calls DesktopModule.Version. Perhaps the GetModuleByDefinition method of the ModuleController is not fully populating the ModuleInfo object with the DesktopModuleId which would be used to populate the new DesktopModule property. You might also need to pass PortalId = -1 rather than the current PortalId to GetModuleByDefinition.
You might try the following to see if the version is available this way:
Dim dmInfo As DotNetNuke.Entities.Modules.DesktopModuleInfo
Dim moduleVersion As String
dmInfo = DotNetNuke.Entities.Modules.DesktopModuleController.GetDesktopModuleByDefinition("xxx_ModuleName", PortalId)
If dmInfo Is Nothing Then
moduleVersion = "Unknown Version"
Else
moduleVersion = dmInfo.Version
End If
If that doesn't return the version, you would probably need to get it directly from the package (again, the below code has not been tested):
Dim pkgInfo As DotNetNuke.Services.Installer.Packages.PackageInfo
Dim moduleVersion As String
pkgInfo = DotNetNuke.Services.Installer.Packages.PackageController.GetPackageByName("xxx_PackageName")
If pkgInfo Is Nothing Then
moduleVersion="Unknown Version"
Else
moduleVersion = pkgInfo.Version.ToString()
End If