jamesmontemagno / DeviceInfoPlugin

Device Information Plugin for Xamarin and Windows
Other
145 stars 44 forks source link

AppVersionNumber Include Build Number? #41

Closed aherrick closed 6 years ago

aherrick commented 6 years ago

Could/Should AppVersionNumberinclude the Build number? I use this to explicitly see build versions when building through Mobile Center. Currently I have a simple DependencyServicewhich does the following. Would love to be able to eliminate and just use AppVersionNumber.

iOS CFBundleVersion:

NSBundle.MainBundle.ObjectForInfoDictionary("CFBundleShortVersionString").ToString() + "." + NSBundle.MainBundle.ObjectForInfoDictionary("CFBundleVersion");

Android VersionCode:

 var context = Android.App.Application.Context;
 var pInfo = context.PackageManager.GetPackageInfo(context.PackageName, 0);
 return pInfo.VersionName + "." + pInfo.VersionCode;

UWP Build:

PackageVersion version = Package.Current.Id.Version;
return $"{version.Major}.{version.Minor}.{version.Build}";
jamesmontemagno commented 6 years ago

Send a PR.

https://github.com/colbylwilliams/VersionTrackingPlugin is the best plugin for this stuff though

jamesmontemagno commented 6 years ago

I think they are 2 different properties really not a combined at all.

There is VersionCode and VersionName

aherrick commented 6 years ago

Yea make sense. Are you suggesting a new property that will just return the "Build"?

iOS/Android/UWP mapping CFBundleVersion/VersionCode/Build respectively.

I could then concatenate together on my own if I desired.

.

jamesmontemagno commented 6 years ago

I am doing this now, just taking from my other project with coby