The Media Center Sandbox

Resources and discussion for developing experiences in the Windows Media Center platform.
Welcome to The Media Center Sandbox Sign in | Join | Help
in Search

How to install an update setup.msi file to the Current Media Center Project?

Last post 09-17-2010, 3:51 AM by thus. 20 replies.
Page 1 of 2 (21 items)   1 2 Next >
Sort Posts: Previous Next
  •  08-19-2010, 7:28 AM 9828

    How to install an update setup.msi file to the Current Media Center Project?

    How can I update my MediaCenter application? I am using the code below in order to update my current installed application:

    InstallationOptions objIns = InstallationOptions.Update;
    AddInHost.Current.ApplicationContext.InstallApplication( SetupLink, objIns);

    It's usage is quite easy and there is no alternative way to update the current Media Center application according to the MSDN.

    When the code triggered above, MediaCenter downloads the new .msi file and starts the installation. When it finishes an error window appears: "Unable to open this application" !!!

    It might be related about GUID or entry points but I don't know how can I handle them.. All I know is the setup.msi file manages everytihing about the entry points during the installation process.

    Has anyone can help me? Thank you for your support.
  •  08-23-2010, 7:41 AM 9832 in reply to 9828

    Re: How to install an update setup.msi file to the Current Media Center Project?

    Can you send a printscreen of the error, and also check in the event log to see if there is any more information.

    Cheers,
    Andrew
  •  08-24-2010, 12:34 AM 9840 in reply to 9832

    Re: How to install an update setup.msi file to the Current Media Center Project?

    There are the process steps of the installation and the log detail screens:

    http://www.imageupload.org/share.php?id=9D1D_4C73743C
    http://www.imageupload.org/share.php?id=FC6C_4C73743C
    http://www.imageupload.org/share.php?id=CD09_4C73743C
    http://www.imageupload.org/share.php?id=8597_4C73743C
    http://www.imageupload.org/share.php?id=D9D9_4C73743C

    And this the C# code which calls the update process in constructor:

    public Application(
    HistoryOrientedPageSession session,
    AddInHost host
    )
    {
    this.session = session;
    this.host = host;

    ArrayListDataSet objList = new ArrayListDataSet();
    objList.Source.Add(DialogButtons.Ok);
    objList.Source.Add(DialogButtons.Cancel);

    DialogResult objDialogResult = MediaCenterEnvironment.Dialog(
    sContent,
    sSubject,
    objList,
    0,
    true,
    null
    );

    if (objDialogResult == DialogResult.Ok)
    {
    InstallationOptions objInstallationOptions = InstallationOptions.Update;
    AddInHost.Current.ApplicationContext.InstallApplication(
    sSetupLink,
    objInstallationOptions
    );
    }
    }

    }
  •  08-24-2010, 10:01 AM 9843 in reply to 9840

    Re: How to install an update setup.msi file to the Current Media Center Project?

    http://www.imageupload.org/share.php?id=D9D9_4C73743C is the important one - can you check if you've got more at the end of the screen (scroll down using the page down key).

    This error should also be stored in the event log, making it easier to cut and paste.

    From the look of the error you aren't instantiating your "Application" object. Where does that initially get instantiated?

    Cheers,
    Andrew
  •  08-25-2010, 3:39 AM 9844 in reply to 9843

    Re: How to install an update setup.msi file to the Current Media Center Project?

    This is the rest of the event:
    http://www.imageupload.org/share.php?id=F933_4C74F122

    Also, probably you are right Andrew, Application should be refreshed but how?

    The code above is triggered in default Application constructor. When I call the update process in constructor and install the new one, I have to refresh the exe to call the Application class again.

    I don't now how the Application class is called? In my opinions, creating a new instance of the Application class in the current Application constructor can't be a solution in this case..

    Can you please give me some C# codes about instantiating the current Application?

    Thank you for your support Andrew.
  •  08-25-2010, 11:47 PM 9845 in reply to 9844

    Re: How to install an update setup.msi file to the Current Media Center Project?

    I get a "can't display page" error when trying to get to that URL.

    The error should be in your event log as well - can you copy and paste the text from there instead?

    Cheers,
    Andrew
  •  08-26-2010, 11:17 PM 9852 in reply to 9845

    Re: How to install an update setup.msi file to the Current Media Center Project?

    Here you go: http://img836.imageshack.us/f/mc06.jpg/

    I hope this screen will help you to give me some advice about my problem Andrew..

    Thank you.
  •  08-27-2010, 6:21 AM 9855 in reply to 9852

    Re: How to install an update setup.msi file to the Current Media Center Project?

    Can you get the text from the event log please.

    Also, can you post your Launch method and Application.cs file

    Cheers,
    Andrew
  •  08-30-2010, 11:27 PM 9856 in reply to 9855

    Re: How to install an update setup.msi file to the Current Media Center Project?

    Hi Andrew,

    You can examine the event log text below. Also I am gonna paste the related C# code blocks..

    Log Name: Media Center
    Source: ehExtHost
    Date: 31.08.2010 09:21:11
    Event ID: 0
    Task Category: None
    Level: Information
    Keywords: Classic
    User: N/A
    Computer: MTW10-PC
    Description:
    Exception Microsoft.MediaCenter.UI.Template.LoadException: resx://MyMediaCenter/MyMediaCenter.Resources/Default(22): Attempt to build an object of type 'Application' failed. (Exception has been thrown by the target of an invocation.)

    at Microsoft.MediaCenter.UI.Template.MarkupSystem.ThrowLoadException(Exception eInner, String stUri, Int32 nLineNumber, String stMessageFormat, Object[] arobjParams)
    at Microsoft.MediaCenter.UI.Template.Blueprint.ThrowLoadException(Exception eInner, String stMessageFormat, Object[] arobjParams)
    at Microsoft.MediaCenter.UI.Template.ObjectBlueprint.Build(Object objContext, Object objRoot)
    at Microsoft.MediaCenter.UI.Template.PropertyBlueprint.BuildValue(ValuePacket packet, Object objRoot)
    at Microsoft.MediaCenter.UI.Template.PropertyBlueprint.Build(Object objContext, Object objRoot)
    at Microsoft.MediaCenter.UI.Template.ViewBlueprint.DeepPropertyOperation.Build(ViewBlueprint vbp, Int32 typeBP, Object objContext, Object objRoot)
    at Microsoft.MediaCenter.UI.Template.ViewBlueprint.Build(Object objContext, Object objRoot)
    at Microsoft.MediaCenter.UI.Host.OnPreInitialize()
    at Microsoft.MediaCenter.UI.ViewItem.PreInitializeTreeWorker()
    at Microsoft.MediaCenter.UI.ViewItem.PreInitializeTreeWorker()
    at Microsoft.MediaCenter.UI.ViewItem.InitializeTree(InitPass pass)
    at Microsoft.MediaCenter.UI.NewUiZone.DeliverInitializations()
    at Microsoft.MediaCenter.UI.NewUiZone.ImplementUiTask(UiTask task, Object param)
    at Microsoft.MediaCenter.UI.UiZone.ProcessUiTask(UiTask task, Object param)
    at Microsoft.MediaCenter.UI.UiSession.ProcessInitialization()
    at Microsoft.MediaCenter.UI.DeferredCall.Dispatch()
    at Microsoft.MediaCenter.Queues.Dispatcher.MainLoop(Queue queue)
    at Microsoft.MediaCenter.UI.UIDispatcher.MainLoop(Queue queue, LoopCondition condition)
    at Microsoft.MediaCenter.UI.UIDispatcher.Run(LoopCondition condition)
    at MediaCenter.Extensibility.Host.Main(String[] args)

    InnerException System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.

    at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType)
    at System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruct signature, RuntimeTypeHandle declaringType)
    at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    at Microsoft.MediaCenter.UI.Template.FastConstructorInfo.Invoke(Object[] arArgs)
    at Microsoft.MediaCenter.UI.Template.ObjectBlueprint.Build(Object objContext, Object objRoot)

    InnerException System.NullReferenceException: Object reference not set to an instance of an object.

    at MyMediaCenter.Application..ctor(HistoryOrientedPageSession session, AddInHost host)
    at MyMediaCenter.Application..ctor()


    Event Xml:



    0
    4
    0
    0x80000000000000

    162
    Media Center
    MTW10-PC



    Exception Microsoft.MediaCenter.UI.Template.LoadException: resx://MyMediaCenter/MyMediaCenter.Resources/Default(22): Attempt to build an object of type 'Application' failed. (Exception has been thrown by the target of an invocation.)

    at Microsoft.MediaCenter.UI.Template.MarkupSystem.ThrowLoadException(Exception eInner, String stUri, Int32 nLineNumber, String stMessageFormat, Object[] arobjParams)
    at Microsoft.MediaCenter.UI.Template.Blueprint.ThrowLoadException(Exception eInner, String stMessageFormat, Object[] arobjParams)
    at Microsoft.MediaCenter.UI.Template.ObjectBlueprint.Build(Object objContext, Object objRoot)
    at Microsoft.MediaCenter.UI.Template.PropertyBlueprint.BuildValue(ValuePacket packet, Object objRoot)
    at Microsoft.MediaCenter.UI.Template.PropertyBlueprint.Build(Object objContext, Object objRoot)
    at Microsoft.MediaCenter.UI.Template.ViewBlueprint.DeepPropertyOperation.Build(ViewBlueprint vbp, Int32 typeBP, Object objContext, Object objRoot)
    at Microsoft.MediaCenter.UI.Template.ViewBlueprint.Build(Object objContext, Object objRoot)
    at Microsoft.MediaCenter.UI.Host.OnPreInitialize()
    at Microsoft.MediaCenter.UI.ViewItem.PreInitializeTreeWorker()
    at Microsoft.MediaCenter.UI.ViewItem.PreInitializeTreeWorker()
    at Microsoft.MediaCenter.UI.ViewItem.InitializeTree(InitPass pass)
    at Microsoft.MediaCenter.UI.NewUiZone.DeliverInitializations()
    at Microsoft.MediaCenter.UI.NewUiZone.ImplementUiTask(UiTask task, Object param)
    at Microsoft.MediaCenter.UI.UiZone.ProcessUiTask(UiTask task, Object param)
    at Microsoft.MediaCenter.UI.UiSession.ProcessInitialization()
    at Microsoft.MediaCenter.UI.DeferredCall.Dispatch()
    at Microsoft.MediaCenter.Queues.Dispatcher.MainLoop(Queue queue)
    at Microsoft.MediaCenter.UI.UIDispatcher.MainLoop(Queue queue, LoopCondition condition)
    at Microsoft.MediaCenter.UI.UIDispatcher.Run(LoopCondition condition)
    at MediaCenter.Extensibility.Host.Main(String[] args)

    InnerException System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.

    at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType)
    at System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruct signature, RuntimeTypeHandle declaringType)
    at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    at Microsoft.MediaCenter.UI.Template.FastConstructorInfo.Invoke(Object[] arArgs)
    at Microsoft.MediaCenter.UI.Template.ObjectBlueprint.Build(Object objContext, Object objRoot)

    InnerException System.NullReferenceException: Object reference not set to an instance of an object.

    at MyMediaCenter.Application..ctor(HistoryOrientedPageSession session, AddInHost host)
    at MyMediaCenter.Application..ctor()



  •  08-30-2010, 11:28 PM 9857 in reply to 9855

    Re: How to install an update setup.msi file to the Current Media Center Project?

    This is the Launch.cs:

    using System.Collections.Generic;
    using Microsoft.MediaCenter.Hosting;

    namespace MyMediaCenter
    {
    public class MyAddIn : IAddInModule, IAddInEntryPoint
    {
    private static HistoryOrientedPageSession s_session;

    public void Initialize(Dictionary appInfo, Dictionary entryPointInfo)
    {

    }

    public void Uninitialize()
    {

    }

    public void Launch(AddInHost host)
    {
    if (host != null && host.ApplicationContext != null)
    {
    host.ApplicationContext.SingleInstance = true;
    }
    s_session = new HistoryOrientedPageSession();
    Application app = new Application(s_session, host);
    app.GoToMenu();
    }
    }
    }

    And this is the Application.cs. I have just paste the Constructor method cus the rest of the code blocks are not connected with Constructor:

    amespace MyMediaCenter
    {
    public class Application : ModelItem
    {
    AddInHost host;
    HistoryOrientedPageSession session;

    #region CONSTRUCTOR
    public Application(): this(
    null,
    null
    )
    {

    }
    #endregion

    #region CONSTRUCTOR
    public Application(
    HistoryOrientedPageSession session,
    AddInHost host
    )
    {
    this.session = session;
    this.host = host;

    p_UpdateCheck objParams = new p_UpdateCheck();
    objParams.Version= Assembly.GetExecutingAssembly().GetName().Version.ToString();

    UpdateInfo objUpdateInfo = new WebService().CheckUpdate(objParams);
    if (objUpdateInfo != null)
    { ArrayListDataSet objList = new ArrayListDataSet();
    objList.Source.Add(DialogButtons.Ok);
    objList.Source.Add(DialogButtons.Cancel);

    DialogResult objDialogResult = MediaCenterEnvironment.Dialog(
    objUpdateInfo.Content,
    objUpdateInfo.Title,
    objList,
    0,
    true,
    null
    );

    if (objDialogResult == DialogResult.Ok)
    {
    InstallationOptions objInstallationOptions = InstallationOptions.Update;
    AddInHost.Current.ApplicationContext.InstallApplication(
    objUpdateInfo.SetupPath,
    objInstallationOptions
    );
    }
    }

    }
    #endregion
  •  08-30-2010, 11:33 PM 9858 in reply to 9857

    Re: How to install an update setup.msi file to the Current Media Center Project?

    Sorry, also need your Default.MCML file too.

    Cheers,
    Andrew
  •  08-31-2010, 6:32 AM 9860 in reply to 9858

    Re: How to install an update setup.msi file to the Current Media Center Project?

    ahh yes.. Unfortunately the Default.mcml is quite huge in order to paste here.

    Also I can asure you that I am not calling the Default.mcml or the other mcml pages before the Constructor method processed. They are not effecting my constructor method :)

    My problem is I don't know how to renew the current exe after the installation completes?
  •  08-31-2010, 10:59 PM 9861 in reply to 9860

    Re: How to install an update setup.msi file to the Current Media Center Project?

    There is something wrong with the way you are instantiating Application.cs according to the logs. I need to see how you are doing that in your default.mcml.

    If you are trying to replace the assembly that you are currently running I wouldn't be surprised if you ran into issues. Try creating a separate assembly for the update and launch that from your main assembly, and terminate the main assembly once launched. At the end of the update, you can then launch the main assembly with the new version.

    Cheers,
    Andrew
  •  09-01-2010, 1:21 AM 9863 in reply to 9861

    Re: How to install an update setup.msi file to the Current Media Center Project?

    Yes, I am trying to replace the assembly that I am currently running and that's why I am getting an error.

    I will apply your suggestions and then write here what has happened. Thank you Andrew.
  •  09-14-2010, 5:37 AM 9886 in reply to 9863

    Re: How to install an update setup.msi file to the Current Media Center Project?

    I generated a new console application. But I couldn't figure out how to register the current Microsoft.MediaCenter.dll and Microsoft.MediaCenter.UI.dll to my project?

    I need them cus I am gonna write my update codes onto the new console application.
Page 1 of 2 (21 items)   1 2 Next >
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems