none
How do you get the application manifest data programatically?

    Question

  • I wish to read some of the properties of the application manifest during runtime using the:

     

     Microsoft.Build.Tasks.Deployment.ManifestUtilities.ApplicationManifest class.

     

      Specifically I wish to determine if "HostInBrowser" is true or false. This can be a variable in our deployment solution.

     

      Is this possible? How can I "grab" the manifest data from the application itself to read it? Its either so painfully obvious I'm missing something or it cannot be done without jumping through hoops.

    Wednesday, April 21, 2010 8:26 PM

Answers

  • Hi

    Just want to verify -- which file are you trying to read?

    yourapp.application (deployment manifest) or yourapp.exe.manifest (application manifest)

    If it's really the application manifest, it is in the same folder as your exe, which you can find by checking the location of the executing assembly.

    You could probably just open it as an XML document and look for what you're looking for; that would probably be easier. Just be careful not to save it, you'll mess up your deployment. The manifests are signed.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Proposed as answer by Kira Qian Thursday, April 22, 2010 3:17 AM
    • Marked as answer by Kira Qian Wednesday, April 28, 2010 8:55 AM
    Thursday, April 22, 2010 12:45 AM
  • I did confirm that this information is not exposed programmatically. Sorry.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Monday, May 31, 2010 3:06 AM

All replies

  • Hi

    Just want to verify -- which file are you trying to read?

    yourapp.application (deployment manifest) or yourapp.exe.manifest (application manifest)

    If it's really the application manifest, it is in the same folder as your exe, which you can find by checking the location of the executing assembly.

    You could probably just open it as an XML document and look for what you're looking for; that would probably be easier. Just be careful not to save it, you'll mess up your deployment. The manifests are signed.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Proposed as answer by Kira Qian Thursday, April 22, 2010 3:17 AM
    • Marked as answer by Kira Qian Wednesday, April 28, 2010 8:55 AM
    Thursday, April 22, 2010 12:45 AM
  • I assume its the application manifest (app.exe.manifest), however the XML does not seem to contain the information I'm seeking.

     

    If you look here: http://msdn.microsoft.com/en-us/library/microsoft.build.tasks.deployment.manifestutilities.applicationmanifest_members.aspx.

    ..you will see the property "HostInBrowser". I wish to know the value of this programatically at run time without having to read any XML. I suppose what I'm trying to do isn't normal or even possible, but I was curious since there appears to be a class that could contain the information (if i was somehow able to clone it from the running app).

    If this isn't the right path, perhaps you can suggest a different solution? We have the same code base that can run as a stand-alone WPF or an XBAP (in browser WPF). A particular code path needs to know -- at run time -- which type of app it is. We shouldn't need defines or different code paths. It should be something I can tell at run time, correct?

     

    Thank you for your help!

    -Rich

     

    Friday, April 23, 2010 1:17 AM
  • Hello Richard,

     

    I did some researches but cannot find a way to detect a WPF application type in run time. As you have done, the manifest doesn’t contain the information you are peeking. I think the information is not stored in the application. Deployment API also doesn’t seem to help anymore.

     

    I understand your purpose of the requirement. But the current product seems impossible. If you really want that function, you can submit a Microsoft Connect to send the suggestion to the product team. When many people require that, product team will consider adding the function in the next version.

     

    Sincerely,

    Kira Qian

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework!
    Monday, April 26, 2010 3:30 AM
  • Hi Richard,

    I actually have an application that uses the namespace you ask about in your original post, but there's no sign of the information you are looking for. I'll ask the ClickOnce product team if they have any ideas.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Monday, April 26, 2010 5:57 AM
  • I did confirm that this information is not exposed programmatically. Sorry.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Monday, May 31, 2010 3:06 AM