Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Create installers dynamically

Create installers dynamically

Scheduled Pinned Locked Moved C#
questionwindows-adminagentic-aihardwaretutorial
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jacob D Dixon
    wrote on last edited by
    #1

    Sorry this question might seem vague, but I was wondering how to create dynamic installers? Maybe I'm not wording it right so let me explain the situation. We use a monitoring software and with this software you can create clients that have location(s). Each time you create a location within a client, you will see another installer popup on the web interface. Now what you do is you download this agent installer for your location, and it will install the agent on your computer. This agent creates a directory on your filesystem along with installs and runs two services. So my question is.. how exactly are they doing this? Because when you create the location it automatically creates a link on the webpage for a installer. Now with this certain installer it somehow has embedded your location ID which makes it when that agent installs it already puts you under that location. I noticed that the location is set in the registry so when it is dynamically creating it, it is embedding it to install setting that registry to that location ID. I've looked using reflector and wasn't able to find it.. it was a pretty large program so I'm still looking. I would love to hear your ideas on making this work similar to that way

    Richard Andrew x64R M 2 Replies Last reply
    0
    • J Jacob D Dixon

      Sorry this question might seem vague, but I was wondering how to create dynamic installers? Maybe I'm not wording it right so let me explain the situation. We use a monitoring software and with this software you can create clients that have location(s). Each time you create a location within a client, you will see another installer popup on the web interface. Now what you do is you download this agent installer for your location, and it will install the agent on your computer. This agent creates a directory on your filesystem along with installs and runs two services. So my question is.. how exactly are they doing this? Because when you create the location it automatically creates a link on the webpage for a installer. Now with this certain installer it somehow has embedded your location ID which makes it when that agent installs it already puts you under that location. I noticed that the location is set in the registry so when it is dynamically creating it, it is embedding it to install setting that registry to that location ID. I've looked using reflector and wasn't able to find it.. it was a pretty large program so I'm still looking. I would love to hear your ideas on making this work similar to that way

      Richard Andrew x64R Offline
      Richard Andrew x64R Offline
      Richard Andrew x64
      wrote on last edited by
      #2

      Hi Jacob, My first guess might be that they are using the Windows Installer API to create MSI databases. See about it here: http://msdn.microsoft.com/en-us/library/aa372860(v=VS.85).aspx[^] See also the database manipulation functions: [^]

      The difficult we do right away... ...the impossible takes slightly longer.

      modified on Sunday, November 21, 2010 4:42 PM

      J 1 Reply Last reply
      0
      • Richard Andrew x64R Richard Andrew x64

        Hi Jacob, My first guess might be that they are using the Windows Installer API to create MSI databases. See about it here: http://msdn.microsoft.com/en-us/library/aa372860(v=VS.85).aspx[^] See also the database manipulation functions: [^]

        The difficult we do right away... ...the impossible takes slightly longer.

        modified on Sunday, November 21, 2010 4:42 PM

        J Offline
        J Offline
        Jacob D Dixon
        wrote on last edited by
        #3

        I don't think they are doing that. Reason is because it is not a MSI file, it is a exe file. I did open reflector on the exe file and see where the install can take arguments but I just don't know how it is getting those arguments from that file you download. I found stuff like this: set.ReadXml(Assembly.GetEntryAssembly().GetManifestResourceStream(Assembly.GetEntryAssembly().GetName().Name.ToString() + ".Template.xml"), XmlReadMode.ReadSchema); So it appears to me that someway when you create a client, they are changing the Template.xml embedded resource. When you go to the webpage and click the link for your agent it is actually pointing to a Deployment.aspx?ID=LOCATIONID page. The number cooresponds with the location ID. Which there are templates that coorespond with that location. So it is changing that template.xml file based upon the location ID and the template is a embedded resource

        modified on Sunday, November 21, 2010 6:34 PM

        N 1 Reply Last reply
        0
        • J Jacob D Dixon

          I don't think they are doing that. Reason is because it is not a MSI file, it is a exe file. I did open reflector on the exe file and see where the install can take arguments but I just don't know how it is getting those arguments from that file you download. I found stuff like this: set.ReadXml(Assembly.GetEntryAssembly().GetManifestResourceStream(Assembly.GetEntryAssembly().GetName().Name.ToString() + ".Template.xml"), XmlReadMode.ReadSchema); So it appears to me that someway when you create a client, they are changing the Template.xml embedded resource. When you go to the webpage and click the link for your agent it is actually pointing to a Deployment.aspx?ID=LOCATIONID page. The number cooresponds with the location ID. Which there are templates that coorespond with that location. So it is changing that template.xml file based upon the location ID and the template is a embedded resource

          modified on Sunday, November 21, 2010 6:34 PM

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          Using the Microsoft API you have the option to create a MSI or a an exe. Without seeing anything you are talking about it is difficult to even guess, however the code could be embedded in the msi database or the code could be constructed on the fly using CodeDOM with the code embedded within it


          I know the language. I've read a book. - _Madmatt

          J 1 Reply Last reply
          0
          • N Not Active

            Using the Microsoft API you have the option to create a MSI or a an exe. Without seeing anything you are talking about it is difficult to even guess, however the code could be embedded in the msi database or the code could be constructed on the fly using CodeDOM with the code embedded within it


            I know the language. I've read a book. - _Madmatt

            J Offline
            J Offline
            Jacob D Dixon
            wrote on last edited by
            #5

            Ahh I was thinking since it was talking about a MSI installer it only did MSI. I don't really have any code. I used reflector to look at the code to see what they were doing. I can try to explain this.. Ok there are agents and each agent have a "location" (city, town, etc). Now there are templates assigned to each location. These templates can contain stuff such as the server address, port, location id, tray icon file, etc. So in the control center application you create your locations and pick the template that goes with them. When you create a location and set the template it creates a link on the webpage for that installer (so it automatically creates a custom installer) So on the web interface where you download the agent EXE file, it is going to a Deployment.aspx page and is passed the LocationID as a query string. You download the EXE file, install it, and now your computer shows up automatically under the correct location. So after digging around in reflector I noticed that the installer is default for all of them. The only thing that changes is the embedded resource Template.xml. So what I think is happening is the Deployment.aspx page is querying the database for the locationid template information and creating a new Template.xml file. It is then replacing the Template.xml that is already in the agent installer with this new Template.xml. So when you install it, it is setting all the information in the template. So my question is if I have a EXE that I created, how do I replace the embedded resource with a updated file? This means I would have to open the EXE file and somehow figure out where the embedded resource file is and replace it programmically.

            1 Reply Last reply
            0
            • J Jacob D Dixon

              Sorry this question might seem vague, but I was wondering how to create dynamic installers? Maybe I'm not wording it right so let me explain the situation. We use a monitoring software and with this software you can create clients that have location(s). Each time you create a location within a client, you will see another installer popup on the web interface. Now what you do is you download this agent installer for your location, and it will install the agent on your computer. This agent creates a directory on your filesystem along with installs and runs two services. So my question is.. how exactly are they doing this? Because when you create the location it automatically creates a link on the webpage for a installer. Now with this certain installer it somehow has embedded your location ID which makes it when that agent installs it already puts you under that location. I noticed that the location is set in the registry so when it is dynamically creating it, it is embedding it to install setting that registry to that location ID. I've looked using reflector and wasn't able to find it.. it was a pretty large program so I'm still looking. I would love to hear your ideas on making this work similar to that way

              M Offline
              M Offline
              Mirko1980
              wrote on last edited by
              #6

              Get a look to Wix. It's essentialy an XML file that contains instructions for generating an MSI. So you could create an XML base template, customize it with the data required by the specific installer you need and then build id by using MSBuild.

              J 1 Reply Last reply
              0
              • M Mirko1980

                Get a look to Wix. It's essentialy an XML file that contains instructions for generating an MSI. So you could create an XML base template, customize it with the data required by the specific installer you need and then build id by using MSBuild.

                J Offline
                J Offline
                Jacob D Dixon
                wrote on last edited by
                #7

                Ahhh I'll take a look at that too. Note: I removed the code since it is not mine. It is code I found using reflector. I feel that I might of violated some license agreement by posting snippets of the code that I found. Although I would love to learn how they were capable of reading the bytes of the executable and replacing only the bytes that related to the Template.xml.... it is not worth being sued over :-) lol

                modified on Monday, November 22, 2010 7:08 PM

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups