Used for. Net early evening events, and there is little or no correct information on the Internet

Source: Internet
Author: User

For a long time, find and installProgramThe MSI source file paths are all "System32" paths. After the installation program is completed, the WIX method is learned and the test is successful.

There are many ways to obtain the source file path on the Internet, such

1. Scan all processes to obtain the meiexec process path.

2. Obtain the path of the current program

3. Obtain the path to initiate the current process

In fact, these paths are not MSI paths. So:

How to obtain the path of the MSI file?

Switch to the "Custom View Interface" and open the "Custom operation" attribute interface. Set the customactiondata attribute to/sdir = [sourcedir].

Then write string sdir = context. Parameters ["sdir"] in the installation method;


Note: 1. If/sdir = [sourcedir] And/sdir = "'[sourcedir]'" are equivalent, the path can be obtained. The difference is that the path obtained by the latter is enclosed in single quotation marks. ( Test supplement : If the path contains spaces You must use the single quotation marks inside the double quotation marks. ) 2. This path must be processed before it can be used. Because of the various escape characters in the system, the obtained path must replace "\" with "\". The method is sdir = sdir. replace ("\\\\", "\\"), you can also write sdir = sdir. replace (@ "\", @ "\"), 3. errors will be reported for other statements.


Why is it not the path of the MSI database file?

The installation program must be divided into two parts: setup.exe and [productname]. MSI.

The former is a Bootstrap program written with us.CodeThe latter is handwritten code and installation-related files.

The path of the MSI source file is an attribute of the MSI. You can right-click the attribute details in the system such as win7 to see the current path of the MSI file, which is not directly seen in server2003.

The command for executing the msifile is msiexec.exe [productname]. MSI ......, In this example, the msiexec.exe path is % WINDIR % \ system32 \ msiexec.exe.

Therefore, none of the above methods are suitable for accessing the msifile in the Windows installerinstallation process, which is the path of msiexec.exe.



What is the purpose of obtaining an MSI file path?

Currently, I think of at least two main functions:

First, most of the time for 64-bit compatibility issues, do not need to separate the x64 and x86 installation packages, but vs does not allow them to be packaged into an MSI database file. Then, after the x86 package is generated, we can use the x64 applet Method to the directory of the installation package or the specified subdirectory, so that it can be called through sdir.

Second, some files are running services for the product during installation, and some files are for installation services. The following files do not necessarily need to be copied to the installation directory. In addition, if the network is installed, you can also protect your programs to be called only during installation.

Please correct the deficiencies

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.