none
Start Installation of msi-package with command RRS feed

  • Question

  •  

    Hello and greetings from Germany,

    I'm new to MSBuild and therfore I may ask a stupid question. I developed a MSi-Package with WIX. What is important for me now is, that I need a Bootstrapper for for ensuring that all necassary components are installed. Sofar this is no problem for me. But after completing this prerequisits I must install the msi with parameters passed to msiexec. I need this Parameters for further processing in the installer. Is there a way to do so with MSBuild, and if yes, how must I configure the Project-File?

    Thanks for your help.

    Greetinge Markus

    Saturday, February 24, 2007 6:32 PM

Answers

  • Sorry for keeping quiet so long, but I had to travel a lot...

    Thanks for your testing. in the meantime I had the chance to talk to one of the developers of msbuild. This is his answer:

    I followed up with Mike Wade, developer extraordinaire for the VS 2005 Bootstrapper and he had the following insight: 

     

    Unfortunately, what you want to accomplish is not possible (due to an oversight on our part). Because the MSI is launched via a call to MsiInstallProduct rather than msiexec.exe directly, the command line arguments you make have to take the form PROPERTYNAME="Property Value". There are 2 work-arounds I can think of for this problem:

     

    1) If you know you are installing on Vista, you can add properties to the property table to help guide logging. See MsiLogging Property and MsiLogFileLocation on MSDN.

     

    2) You could write your own stub executable that would first call out to the bootstrapper's setup.exe followed by a call to msiexec.exe.

     

    Sorry I don't have a better answer for you, but I hope that little bit helps

    Raphael, the article you provided to me is great. I think the biggest problem ist, that an application like setup mentioned in the article needs to be independent from the .NET Framework. Thats why I tried to use the bootstrapper from Visual Studio to check all dependencies and than start the installation written in C#.  My installation package starts with parameters, the logging parameter is just an example. Following the advise above I created an helper-application that is started by the bootstrapper. This helper-application checks all requierements and generates the necassary parameters. Then it calls msiexec with the correct command line. This works nicely now.

     

    Saturday, March 10, 2007 2:46 PM

All replies

  • You can run programs using the Exec task. See:
    http://msdn2.microsoft.com/en-us/library/x8zx72cd.aspx
    Monday, February 26, 2007 5:09 PM
  • Hello Raphael,

     

    thanks for your answer. I tried to change my xml-File, but it seems I'm still making mistakes.

    What I want to do ist, that the main package (upgrade.msi) should be started by the bootstrapper after ensuring that the necessary components are installed. So I changed my file to the following:

    <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
       <ItemGroup>
          <!-- Include the 'Product Code' for every package you want -->
          <BootstrapperFile Include="Microsoft.Net.Framework.2.0">
          </BootstrapperFile>
       </ItemGroup>

       <Target Name="Bootstrapper">
          <GenerateBootstrapper
             ApplicationName="FooBar"
             ApplicationFile="upgrade.msi"
             BootstrapperItems="@(BootstrapperFile)"
             Culture="en"
             CopyComponents="True"
             OutputPath="C:\CustomBootstrapper\" />
     <Exec Command="msiexec upgrade.msi /l*v bootstrapper.log"/>
       </Target>
    </Project>

    But when I try to compile it I get the following error: error MSB3073 The msiexec upgrade.msi /l*v bootstrapper.log finished with code 1639.

    It would be great if anybody could help me to clear this.

    Greetings Markus

     

    Wednesday, February 28, 2007 7:17 PM
  • I think you may be missing a /i in your commandline. Try going to a command prompt (type 'cmd' in Start > Run). Then run 'msiexec'. On my computer, it brings up a window telling how to use the command line parameters with msiexec.exe.

    If you want to install a .msi file, you need to do msiexec /i package.msi. If you forget the /i, it just brings up the help window.

    I would say that you should first get the install working just from the command line and then copy that command line exactly to your MSBuild script.

    Hope this helps!

    Wednesday, February 28, 2007 8:43 PM
  • Hello Raphael,

     

    thanks for the hint. But unfortunatly I didn't bring the result I expected. The msbuild task works correct now, but it starts the installation at build--time, and the in the install.log it stil the entry:

    Using MsiInstallProduct with package path 'C:\CustomBootstrapper\upgrade.msi' and command line ''

    If I do it as a command line install everythings works as expected. Do you've an idea how to fix it? If not I feel I need to write my own bootstrapper...

    Thanks again for you help.

    Greetings Markus

    Wednesday, February 28, 2007 10:07 PM
  • Hey Markus,

    I'm not quite sure what you're trying to do. What exactly isn't working as expected? What command do you have on the command line?

    I haven't ever used bootstrappers, so I'm not familiar with how they work and if the problem lies there, I don't think I would be able to help you.

    Wednesday, February 28, 2007 10:16 PM
  • Hallo Raphael,

    what I try to is, that the bootstrapper itself starts the installation after checking the requirements. In the node for generating a Bootstrapper (GenerateBootstrapper) ist a property called ApplicationFile. There can you secify what the instller should do, start program, a msi-package etc. I can specify my msi-file ther and this starts correctly. But I need to start the installation with parameters, the shown example with the logging enabled is just an example for what I need to do. Unfortunatly I didn't see a possibiity to start the installtion with parameters. The Exec-Node you showed me starts at build-time, while compiling the setup.exe, but when starting the real installation no parameter, or commant is passed to the msi-file.

    Greetings Markus

     

    Wednesday, February 28, 2007 10:29 PM
  • I did some brief research and testing on bootstrapping.

    In the GenerateBootstrapper task, it looks like it takes in the filename of a .msi file and then outputs a setup.exe to a location. Then you have to make sure the .msi file is in the same folder as setup.exe.

    It looks like setup.exe can't just pass all the parameters to the .msi file, though it apparently can pass properties to it. The best reference I found of it is here: http://msdn2.microsoft.com/en-us/library/aa367832.aspx

    Now, I don't understand why you're trying to do this in MSBuild. From what I found, a bootstrapper is designed to make sure you have required dependencies installed. As for .NET 2.0, if you can run MSBuild, you have .NET 2.0 installed because MSBuild comes with it. If this is to be an automated install, you should have the machine where you're running it on set up correctly in the first place because you have control over it. Setup.exe should really only be run by the end user because you don't know how their computer is set up.

    If you are trying to do an automated build of the installer, and then do an automated install, I would say just create the bootstrapper and then just run msiexec /i upgrade.msi.

    I don't understand your statement: "The Exec-Node you showed me starts at build-time". What are you trying to accomplish with the build script exactly? The build script runs at build time. So everything you tell the build script to do will run at build time. Are you trying to create a setup.exe file so that later on when you run it manually it creates a log file? Because if so, you can't do it with MSBuild. You will have to refer to the article I posted a link to above and somehow run setup.exe differently. Although, I'm not sure if you can do logging while running the bootstrapper.

    Thursday, March 1, 2007 4:13 PM
  • Sorry for keeping quiet so long, but I had to travel a lot...

    Thanks for your testing. in the meantime I had the chance to talk to one of the developers of msbuild. This is his answer:

    I followed up with Mike Wade, developer extraordinaire for the VS 2005 Bootstrapper and he had the following insight: 

     

    Unfortunately, what you want to accomplish is not possible (due to an oversight on our part). Because the MSI is launched via a call to MsiInstallProduct rather than msiexec.exe directly, the command line arguments you make have to take the form PROPERTYNAME="Property Value". There are 2 work-arounds I can think of for this problem:

     

    1) If you know you are installing on Vista, you can add properties to the property table to help guide logging. See MsiLogging Property and MsiLogFileLocation on MSDN.

     

    2) You could write your own stub executable that would first call out to the bootstrapper's setup.exe followed by a call to msiexec.exe.

     

    Sorry I don't have a better answer for you, but I hope that little bit helps

    Raphael, the article you provided to me is great. I think the biggest problem ist, that an application like setup mentioned in the article needs to be independent from the .NET Framework. Thats why I tried to use the bootstrapper from Visual Studio to check all dependencies and than start the installation written in C#.  My installation package starts with parameters, the logging parameter is just an example. Following the advise above I created an helper-application that is started by the bootstrapper. This helper-application checks all requierements and generates the necassary parameters. Then it calls msiexec with the correct command line. This works nicely now.

     

    Saturday, March 10, 2007 2:46 PM
  • Excellent. That is good to know. Thanks for sharing your findings.
    Monday, March 12, 2007 3:46 PM