One of the three things of. Net deployment-how to create an update msp for the vs Installation File MSI

Source: Internet
Author: User

Preface

The tools used in this article are vs IDE and orca.exe. Therefore, other packaging tools such as InstallShield and wise are not covered, in addition, InstallShield and wise are required to make installation files and update patches more complex than vs IDE and orca.exe.

Secondly, the background of this article is that the author finds that there are few articles in China on how to create an MSP update Patch Based on the MSI created in the vs ide setup project (installation and deployment project, so after querying a lot of English articles, summed up the following experience, most of the content may be just http://www.codeproject.com/KB/install/dotnetpatching.aspx? FID = 209224 & Fr = 51 & DF = 90 & MPP = 25 & Noise = 3 & sort = Position & view = quick # How to Create installation patches for vs in xx0xx. net deployment projects. (If you are a good friend of the English language, you can read the above, but I also have some experience to solve the problems encountered by creating MSP following the above steps)

Preparation

1, first need to download microsoft Platform SDK, address: http://www.microsoft.com/downloads/details.aspx? Familyid = A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5 & displaylang = en;

2,After the download, install orca. MSI (orca is actually a Microsoft tool used to edit and configure MSI, MSP, and open the PCP file required to make MSP). Under the installation directory of Microsoft platform SDK,C: \ Program Files \ Microsoft platform SDK \ bin \;

3. The MSI installation file before the upgrade and the corresponding vs installation and deployment project are required. (Note that all the preparation files in codeproject are placed in the directory where the installation and deployment project is located, otherwise, apply the patch provided by it. CMD will cause an error. In fact, you do not need to create a working directory under the installation and deployment directory. However, if you are not familiar with the orca tool at the beginning, set the working directory according to the text in codeproject. Remember that all directories should not be too long. It is best to have no special characters or spaces .)

4. In the working directory, you must have the following sub-directories: targetimage and upgradedimage. targetimage is used to store the MSI installation files before the upgrade, and upgradedimage is used to store the MSI installation files after the upgrade; (If the upgraded installation file is not generated, skip this step .) Attention should be paid here to remind the readers who make MSP according to codeproject, because it uses patches in the article. CMD is not used in this article. Therefore, the readers who create MSP according to codeproject need to establish a directory structure that is not used, so we will not describe it here.

5. You need to have some basic knowledge about creating installation files, such as the main version number majorversion, minor version number, productcode, upgradecode, and so on.

Procedure

1,SetC: \ Program Files \ Microsoft platform SDK \ samples \ sysmgmt \ MSI \ PatchiNg \Template. PCPCopy to the working directory and rename itPatch. PCP(The name can be customized, but note thatPatch. cmd)

2,ExploitationOrcaOpenPatch. PCP, IsImagefamiliesAdd a record to a table,FamilyThe field must be assigned a value, which can be customized. This value indicates that the family of the product is added with the main version number, for exampleESRIAssign this valueArcgis92;

3. Add a row of records for the patchsequence table, and set patchfamilyFamilyValue (or different ),The sequence field is 1.0.0 (for field settings in all PCP tables, see http://msdn.microsoft.com/en-us/library/aa370890 (vs.85). aspx );

4,Modify the records in the properties table. Right-click the patchguid and select and paste it to generate a new GUID (it is very important that every time the MSP is created, it needs to be regenerated. I have made similar errors, it takes half a day to find the cause), patchoutputpath sets the address to be exported, which can be set to patch \ patch. MSP, note that this is a relative directory, relativePatch. PCPFile, and add a record to the table,Name:Minimumrequiredmsiversion,Value:200;

5,IsAdd a record to the targetimages table, target: Customizable (we recommend that you add the previous version number to the family value, for example, arcgis92msi1, because multiple records can be added to this table, in the future, the application will upgrade multiple target versions to the latest version, which will be detailed later. This section is not mentioned in codeproject and is an advanced application.), msipath: targetimage \ setup. MSI (relative directory, note setup. the MSI file name does not need to be changed to the reader's MSI file name, because in the patch. in cmd, copy the MSI of the reader to setup. MSI. You can read the patch carefully. CMD), upgraded: corresponds to this value in the following upgradeimages table (we recommend that you add the upgraded version number to the family value, such as arcgis92msi2.), order: 1 (the size sequence is required for multiple records, which will be detailed later), ignoremissingsrcfiles: 0;

6. Add a record to the upgradeimages table. Upgraded: corresponds to the value in the above table, msipath: upgradedimage \ setup. MSI (you do not need to change the directory here. CMD), family: corresponds to this value in the imagefamlies table.

7. Create the patch. CMD file. (refer to the patch. CMD file of the codeproject document)

@ Setlocal

@ Set Path = % PATH %; "C: \ Program Files \ Microsoft platform SDK \ samples \ sysmgmt \ MSI \ patching"

@ Set patchtmp = c: \ tmp1

: OK

Rmdir/S/Q % patchtmp %

Mkdir c: \ tmp1

Mkdir c: \ tmp1 \ targetimage

Mkdir c: \ tmp1 \ upgradedimage

Mkdir c: \ tmp1 \ patch

For % A in ("targetimage \ *. MSI") do copy "% A" C: \ tmp1 \ setup. MSI

Msiexec/QB/A c: \ tmp1 \ setup. MSI targetdir = c: \ tmp1 \ targetimage \/L * v c: \ tmp1 \ targetimage \ setup. Log

Del c: \ tmp1 \ setup. MSI

For % A in ("upgradedimage \ *. MSI") do copy "% A" C: \ tmp1 \ setup. MSI

Msiexec/QB/A c: \ tmp1 \ setup. MSI targetdir = c: \ tmp1 \ upgradedimage/L * v c: \ tmp1 \ upgradedimage \ setup. Log

Del c: \ tmp1 \ setup. MSI

Copy patch. PCP c: \ tmp1

Set patchdir = % Cd %

C:

CD tmp1

Msimsp-s patch. PCP-P patch \ patch. MSP-l patch \ patch. Log-f c: \ tmp1 \ TMP-d

Rmdir/S/q c: \ tmp1 \ targetimage

Rmdir/S/q c: \ tmp1 \ upgradedimage

Rmdir/S/q c: \ tmp1 \ TMP

F:

Cd % patchdir %

Mkdir patch

Mkdir patch \ % 1

Copy c: \ tmp1 \ patch \ *. * patch \ % 1 \*.*

Rmdir/S/q c: \ tmp1

: End

Pause

Note: locate F: This row, and change it to the drive letter of the reader's working directory. Remember.

8. Generate the upgraded Installation File MSI and modify the attribute version of The vs installation and deployment project. (for example, if it is 1.0.0 before the upgrade, you can change it to 1.0.1. Note that the version number is changed, for the major version number and minor version number upgrade, see msdn .) At this time, the system prompts whether to automatically modify productcode and upgradedcode. Note that this is critical and you must remember to select No. Specifically, readers who have certain knowledge about productcode and upgradedcode must understand the meaning here. Each product family of upgradedcode is the same, and productcode must be modified only when the main version is upgraded, MSP is generally used for upgrading the smallest version number. Therefore, do not change it in one sentence. (If there is a problem, I cannot solve it)

9. Copy the generated msi to the upgradedimage in the working directory. You do not need to perform this step according to the codeproject text, because the patch in the text in it. CMD will automatically read the MSI in the DEBUG directory, which is why the reader must copy all files to the installation and deployment project directory.

10. This step does not need to be executed. Every time you build and install a deployment project, the system automatically updates packagecode. Here, if you modify packagecode, you can use Orca to open MSI, modify the abstract information in the View menu.

11. Finally, run the patch. cmd. The execution time is very short if there are not many changes before and after, and there are few packaging files. If there is a large change, just wait a few minutes to smoke and have a cup of coffee. Note: The includewholefilesonly field in the properties table is used to determine whether to extract incremental data when the package file is not the same, or directly take the entire new file. The former can reduce the size of MSP, but it takes a long time to execute MSP, the latter is the opposite.

About patchcmd:

1. First, set the path and temporary directory of the environment variable;

2. If a temporary file exists, delete it first, and then create a directory format;

3. Copy the MSI to the temporary directory before the upgrade and decompress it with msiexec. Note: targetdir = c: \ tmp1 \ targetimage \. Do not use the same directory as the copied MSI, because after the MSI is decompressed, an MSI with the same small file name will be generated, which will lead to an error in the msiexec decompression; (the whole step is miserable by the author)

4. Copy the upgraded MSI to the temporary directory and decompress it using msiexec;

5. Copy the PCP file to the temporary directory and use msimsp to generate the MSP;

6. Copy the generated MSP to the working directory and delete the temporary directory.

For the major version, minor version, and minimum version number (when the version format is 1.0.0, my personal opinions are as follows ):

1. When the program is only partially updated with minor changes and a small number of bugs are fixed, you can choose to release the MSP and modify the minimum version number without changing the productcode;

2. When the program updates code of a large number of modules, major changes and adjustments are made, but the structure remains unchanged. You can modify the second-digit version number, change the productcode, and re-release the MSI;

3. When the program architecture changes, for example, from process-oriented change to object-oriented full-component architecture, the main version number is modified, the productcode is changed, and the MSI is released again.

Upgrade multiple target versions to the latest version:

A record in targetimages is updated to the latest version, for example, 1.0.0 to 1.0.2, 1.0.1 to 1.0.2. In this way, the created MSP can be used to upgrade 1.0.0 and 1.0.1 to 1.0.2, if only 1.0.1 to 1.0.2 is available, you cannot upgrade 1.0.0 to 1.0.2. The corresponding patch. CMD and working directory structures only need to be slightly changed to achieve the goal. The following patch. CMD is for reference:

@ Setlocal

@ Set Path = % PATH %; "C: \ Program Files \ Microsoft platform SDK \ samples \ sysmgmt \ MSI \ patching"

@ Set patchtmp = c: \ tmp1

: OK

Rmdir/S/Q % patchtmp %

Mkdir c: \ tmp1

Mkdir c: \ tmp1 \ targetimage

Mkdir c: \ tmp1 \ targetimage \ 1

Mkdir c: \ tmp1 \ targetimage \ 2

Mkdir c: \ tmp1 \ targetimage \ 3

Mkdir c: \ tmp1 \ upgradedimage

Mkdir c: \ tmp1 \ patch

For % A in ("targetimage \ 1 \ *. MSI") do copy "% A" C: \ tmp1 \ setup. MSI

Msiexec/QB/A c: \ tmp1 \ setup. MSI targetdir = c: \ tmp1 \ targetimage \ 1/L * v c: \ tmp1 \ targetimage \ setup. Log

Del c: \ tmp1 \ setup. MSI

For % A in ("targetimage \ 2 \ *. MSI") do copy "% A" C: \ tmp1 \ setup. MSI

Msiexec/QB/A c: \ tmp1 \ setup. MSI targetdir = c: \ tmp1 \ targetimage \ 2/L * v c: \ tmp1 \ targetimage \ setup. Log

Del c: \ tmp1 \ setup. MSI

For % A in ("targetimage \ 3 \ *. MSI") do copy "% A" C: \ tmp1 \ setup. MSI

Msiexec/QB/A c: \ tmp1 \ setup. MSI targetdir = c: \ tmp1 \ targetimage \ 3/L * v c: \ tmp1 \ targetimage \ setup. Log

Del c: \ tmp1 \ setup. MSI

For % A in ("upgradedimage \ *. MSI") do copy "% A" C: \ tmp1 \ setup. MSI

Msiexec/QB/A c: \ tmp1 \ setup. MSI targetdir = c: \ tmp1 \ upgradedimage/L * v c: \ tmp1 \ upgradedimage \ setup. Log

Del c: \ tmp1 \ setup. MSI

Copy patch4.pcp c: \ tmp1

Set patchdir = % Cd %

C:

CD tmp1

Msimsp-s patch4.pcp-P patch \ patch4.msp-l patch \ patch4.log-f c: \ tmp1 \ TMP-d

Rmdir/S/q c: \ tmp1 \ targetimage \ 1

Rmdir/S/q c: \ tmp1 \ targetimage \ 2

Rmdir/S/q c: \ tmp1 \ targetimage \ 3

Rmdir/S/q c: \ tmp1 \ targetimage

Rmdir/S/q c: \ tmp1 \ upgradedimage

Rmdir/S/q c: \ tmp1 \ TMP

F:

Cd % patchdir %

Mkdir patch

Mkdir patch \ % 1

Copy c: \ tmp1 \ patch \ *. * patch \ % 1 \*.*

Rmdir/S/q c: \ tmp1

: End

Pause

Reference link:

1, http://www.codeproject.com/KB/install/dotnetpatching.aspx? FID = 209224 & Fr = 1 & DF = 90 & MPP = 25 & Noise = 3 & sort = Position & view = quick # xx0xx

Http://msdn.microsoft.com/en-us/library/aa367816 (vs.85). aspx

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.