locked
Get number version in html RRS feed

  • Question

  • I'm using the code below in LS lightswitch fo get number version
    var version = new AssemblyName(System.Reflection.Assembly.GetExecutingAssembly().FullName).Version;

    How do I do in html? 

    Estudando Windows Phone, Windows 8 e LightSwitch, muito bom!!!

    Tuesday, September 23, 2014 2:40 AM

Answers

  • @Estudando - after creating the WebAPI method you would just make a call to that WebAPI method in the _created() event of your home screen to obtain the value and then you just display it.

    If you need to have that value available globally throughout your application you could just add it to the myapp global variable like so:

    myapp.ProgramVersion = ...read value from WebAPI...

    You will now be able to access myapp.ProgramVersion from any screen.


    Regards, Xander. My Blog

    Friday, September 26, 2014 5:14 AM
  • I thought there was a native option in javascript. 

    I understand your explanation about create a webapi and get this information. 
    It is a good idea.

    But, is there any way for create dynamic javascript in each build on lightswitch client and expose it for browser?

    Estudando Windows Phone, Windows 8 e LightSwitch, muito bom!!!

    Friday, September 26, 2014 1:48 AM

All replies

  • Hi Leandro,

    We can get version number using code snippet below.

    partial void Start_InitializeDataWorkspace(List<IDataService> saveChangesTo)
    {
        string pVersionsNr = GetVersionNr();
    }
    private string GetVersionNr()
    {
        var name = new AssemblyName(System.Reflection.Assembly.GetExecutingAssembly().FullName);
        return name.Version.ToString();
    }

    Could you give more explanation about why you want to do that?

    Please let me know if there is anything that I can do to help.

    Best regards,

    Angie


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, September 25, 2014 9:09 AM
  • If you want to do this you will need to make a call to the server, the easiest way to do this is to create a WebAPI in the Server project.  Your WebAPI method could contain what you have above and return the version number to the client.  Here is an article that outlines how to use WebAPI with LightSwitch:

    http://blogs.msdn.com/b/bethmassi/archive/2013/07/31/calling-stored-procs-in-your-lightswitch-databases-using-web-api.aspx



    David Kidder | Senior SDET | Microsoft | LightSwitch

    Thursday, September 25, 2014 3:33 PM
    Moderator
  • I thought there was a native option in javascript. 

    I understand your explanation about create a webapi and get this information. 
    It is a good idea.

    But, is there any way for create dynamic javascript in each build on lightswitch client and expose it for browser?

    Estudando Windows Phone, Windows 8 e LightSwitch, muito bom!!!

    Friday, September 26, 2014 1:48 AM
  • @Estudando - after creating the WebAPI method you would just make a call to that WebAPI method in the _created() event of your home screen to obtain the value and then you just display it.

    If you need to have that value available globally throughout your application you could just add it to the myapp global variable like so:

    myapp.ProgramVersion = ...read value from WebAPI...

    You will now be able to access myapp.ProgramVersion from any screen.


    Regards, Xander. My Blog

    Friday, September 26, 2014 5:14 AM