Jump to content



Photo

C# Metro App (name, version, etc)

c# windows store metro

  • Please log in to reply
2 replies to this topic

#1 James Rose

James Rose

    Software Developer

  • Tech Issues Solved: 1
  • Joined: 20-January 04
  • Location: New York City

Posted 03 April 2013 - 19:43

Hello gang,

I am migrating an application from VB to C#/Metro. Currently I am attempting to get the app name and version. In standard c# (non-Metro) I can get the app name with:
string sAppName =  Assembly.GetEntryAssembly().GetName().Name;

However these are not available in Metro apps (I'm planning on this app being available for Phone and Surface) Any thoughts?

Thanks


#2 Eric

Eric

    Neowinian Senior

  • Tech Issues Solved: 11
  • Joined: 02-August 06
  • Location: Greenville, SC

Posted 07 April 2013 - 18:51

var packageName = Windows.ApplicationModel.Package.Current.Id.Name;
var packageVersion = Windows.ApplicationModel.Package.Current.Id.Version;

That should get you both. If your package name is set as a Guid still that's all you will get for the name. :/

#3 OP James Rose

James Rose

    Software Developer

  • Tech Issues Solved: 1
  • Joined: 20-January 04
  • Location: New York City

Posted 08 April 2013 - 18:52

var packageName = Windows.ApplicationModel.Package.Current.Id.Name;
var packageVersion = Windows.ApplicationModel.Package.Current.Id.Version;

That should get you both. If your package name is set as a Guid still that's all you will get for the name. :/


Thank you kindly, that will at the very least give me a start.

Have a great day