This is a migrated thread and some comments may be shown as answers.

ClickOnce Publish Version & Assembly Version

3 Answers 775 Views
General discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mike
Top achievements
Rank 1
Mike asked on 28 Nov 2013, 11:17 AM
I noticed that the analytics reports on the assembly version of the application, which in my environment we don't use as the deployment is a C# WPF app deployed via ClickOnce. 

Is it possible to get the ClickOnce deploy version recorded as the version for the application in the analytics reports?

I can manually set the assembly to match the ClickOnce, which I'll do for now, but it would be far neater if there was a choice of using the assembly or the deploy version.

Thanks, Mike...

3 Answers, 1 is accepted

Sort by
0
Richard Flamsholt
Telerik team
answered on 28 Nov 2013, 04:27 PM
Hi Mike,

Yes, by default the monitor use the version number of the assembly, using Assembly.GetEntryAssembly() as the first choice and Assembly.GetCallingAssembly() it the former returns null.

But it's possible to report any version number you want: simply create the monitor with settings and in those settings specify the desired version number. Like so:

        var settings = AnalyticsMonitorFactory.CreateSettings(ProductID);
        settings.Version = new Version(1, 2, 3, 4);
        var monitor = AnalyticsMonitorFactory.CreateMonitor(settings);

I'm not certain about the specifics of retrieving the version number in a ClickOnce scenario like yours, but I'd be happy to hear about how you solve it so we can start a "best practices" for ClickOnce deployed applications.

Regards,
Richard Flamsholt
Telerik
ICENIUM MONITOR AVAILABLE FOR DOWNLOAD.
Monitor and track applications built with Icenium at run-time. Reduce support by fixing run-time crashes as they occur, obtain user insights such as location and system configuration, find and remove application bottlenecks, and track which features are used most to help prioritize development.
Try Icenium with EQATEC Analytics today >>
0
Mike
Top achievements
Rank 1
answered on 03 Dec 2013, 09:57 PM
This is the code I am pretty much using now. The IAnalyticsMonitor is declared in the main view model and I also do a .Start() from here also. The ClickOnce exposes an "isNetworkDeployed" bool, so it's easy to see if you're running in ClickOnce or are deploying from a network source. I have only ever used ClickOnce, so not sure about other methods here.

Hope this helps, Mike...


public static IAnalyticsMonitor analyticsMonitor;
public static IAnalyticsMonitorSettings amSettings = AnalyticsMonitorFactory.CreateSettings("XYZ");
//...
 
    if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed)
    {
        appVersion = ApplicationDeployment.CurrentDeployment.CurrentVersion;
    }
    else
    {
        appVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
    }
 
    if (!Debugger.IsAttached)
    {
        amSettings.TestMode = false;
    }
    else
    {
        amSettings.TestMode = true;
    }
 
// technically don't need to do this next statement as both amSettings.Version and appVersion are both of type "Version".  
    amSettings.Version = new Version(appVersion.Major, appVersion.Minor, appVersion.Build, appVersion.Revision);
     
      analyticsMonitor = AnalyticsMonitorFactory.CreateMonitor(amSettings);
    analyticsMonitor.Start();


          
0
Richard Flamsholt
Telerik team
answered on 10 Dec 2013, 02:41 PM
Hi Mike,

Great, thanks!

We'll be giving our documentation a major overhaul soon and I've added the relevant part of your snippet to be included in a section about using Analytics in a Click-Once app.

Regards,
Richard Flamsholt
Telerik
ICENIUM MONITOR AVAILABLE FOR DOWNLOAD.
Monitor and track applications built with Icenium at run-time. Reduce support by fixing run-time crashes as they occur, obtain user insights such as location and system configuration, find and remove application bottlenecks, and track which features are used most to help prioritize development.
Try Icenium with EQATEC Analytics today >>
Tags
General discussion
Asked by
Mike
Top achievements
Rank 1
Answers by
Richard Flamsholt
Telerik team
Mike
Top achievements
Rank 1
Share this question
or