Do. NET will be used sooner or later, and there is no correct information on the Web or almost rarely

Source: Internet
Author: User

Original URL: http://www.cnblogs.com/langu/archive/2012/03/23/2413990.html

All along, looking for the installation program MSI source file path is "system32" path, the installation process is done, learning WiX found the method, and has been tested successfully.

There are many ways to get source file paths on the web, such as

1. Scan all current processes to get the path of the meiexec process

2. Get the path of the current program

3. Get the path that originated the current process

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

How do I get the path to the MSI file?

Switch to "Custom View interface" To open the "Custom Actions" property interface with the CustomActionData property filled in/sdir=[sourcedir],

Then write the string sdir=context.parameters["Sdir" in the installation method;

Note: 1,/sdir=[sourcedir] and/sdir= "' [SourceDir] '" are equivalent to obtain the path, the difference is that the latter gets the path has "'" single quotation marks. (Test add: If the path contains spaces, you must use double quotation marks inside the method of single quotation marks) 2, the path needs to be processed to use, due to the various escape characters within the system, the resulting path needs to replace "\ \" with "\", Method Sdir=sdir.replace ("\\\\", "\ \ "), can also write Sdir=sdir.replace (@" \ \ ", @" \ "), 3, other writing will be error

Why is the path not the MSI database file?

We need to divide the installer into two parts, one is Setup.exe, the other is [Productname].msi

The former is the bootloader, regardless of the code we write, the latter is handwritten code and installation-related files and so on.

The path to the MSI source file is a property of the MSI, and in systems such as Win7, right-click Property details can see the path of the MSI file now, which is not directly visible in the server2003.

The command to execute the MSI file is Msiexec.exe [Productname].msi ..., where the Msiexec.exe path is%windir%\system32\msiexec.exe

So none of the previous methods are appropriate for the path to the MSI file during Windows Installer installation, and those methods are Msiexec.exe paths.

What is the use of obtaining the MSI file path?

At the moment I think of at least 2 main roles:

First, most of the time on a 64-bit compatibility issue, there is no need to separate the x64 and x86 packages, but vs does not allow the two to be packaged in an MSI database file. Then we can use the x64 applet method to the directory of the installation package or to the specified subdirectory when the x86 package is finished, so that it can be called through Sdir.

Second, when installing some files for the product running service, some files are for installation services. The latter file does not necessarily need to be copied to the installation directory, and if the network is installed, you can also protect the program you write to call

Please correct me for the shortcomings.

Do. NET will be used sooner or later, and there is no correct information on the Web or almost rarely

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: info-contact@alibabacloud.com 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.