This release is one of these two days to do a WiX tool Quickwix, mainly to solve two problem points 1. Quickly generate WiX tags for large files (files,directories,componentref); 2. Compare two engineering differences before and after comparison. Large WiX project has thousands of files, developers add DLLs, or resource files are not deterministic, and many times we can not directly replace, so we need a comparison of the function to tell the Packer where the new, where deleted, so faster packaging speed.
First, Introduction
The tool is a simple WinForm program. Here are a few things to note.
1. Generate XML: will be more path and variable information, generate Fragment,feature and directory.
2. Contrast: Find out the differences in file, directory, and component information:
3. Automatically save the latest project: If selected, the current project information will be saved in comparison.
4. Save: Save current project information manually
5. Catalog: Catalog information for the current project.
6. Component: Component information for the current project.
7. Catalog: Catalog information for the current project.
Second, the principle
1. The project catalog is as follows, all WiX first-off objects inherit the Iwixbase interface.
The WiX tag used to generate the object itself. This way, when there are subclasses, the Towixstring () method of the subclass is called.
Public Interface Iwixbase { //<summary> /// back to WiX tags /// </summary> /// <returns></returns> string towixstring (); }
2.WixProj contains Wixdirectory,wixfragment,wixfeature, which is the element of the most parent class of the WiX object. is also the object used to save the XML.
[Serializable] Public classWixproj:iwixbase {Privatewixdirectory _wixdirectory; Privatewixfragment _wixfragment; Privatewixfeature _wixfeature; /// <summary> ///Compare Directory/// </summary> Publicwixdirectory wixdirectory {Get{return_wixdirectory?? (_wixdirectory=Newwixdirectory ()); } Set{_wixdirectory =value;} } /// <summary> ///Compare Files/// </summary> Publicwixfragment wixfragment {Get{return_wixfragment?? (_wixfragment=Newwixfragment ()); } Set{_wixfragment =value;} } /// <summary> ///Compare Componentref/// </summary> Publicwixfeature wixfeature {Get{return_wixfeature?? (_wixfeature=Newwixfeature ()); } Set{_wixfeature =value;} } Public stringtowixstring () {varSB =NewStringBuilder (); Sb. Append (Wixfragment.towixstring ()); Sb. Append ("\ r \ n"); Sb. Append ("\ r \ n"); Sb. Append (Wixdirectory.towixstring ()); Sb. Append ("\ r \ n"); Sb. Append ("\ r \ n"); Sb. Append (Wixfeature.towixstring ()); returnsb. ToString (); } }
View Code
Call its Towixstring method to get the entire project WiX element.
3.WixComparator, which is used to compare engineering, contains two Wixproj objects, one for loading XML, and one for the current project.
Its Begincompare method is used to start comparing differences. It is also divided into three parts to compare. For example, files are compared to new, deleted, and modified. Directories and components do not contain modified portions (they are an ID).
/// <summary> ///Start comparing///Return Files Differences///Return Components Differences///Return Directory Differences/// </summary> /// <returns>Compare Results</returns> Public stringBegincompare () {//Compare Files First//you need to compare directories//if the previous non-existent there is no need to compare if(beforewixproj==NULL) { return "---The old project does not exist---\ r \ n"; } varSB =NewStringBuilder (); Sb. Append (Comparedirectoryrefs ()); Sb. Append (Comparedirectory ()); Sb. Append (Comparecomponerefs ()); if(sb.) Length = =0) {sb. Append ("\ r \ n These two project documents are consistent! "); } returnsb. ToString (); }
Other WiX objects have a compare method. Used to compare with objects of the same type. The object is initialized in the Generatewixml class.
The 4.Wixconfig contains configuration information such as registration files, filter suffixes, initial components, and so on.
Summary: The next idea is to be able to automatically modify the Wxs file before the package project is compiled, otherwise it is really troublesome to open the engineering changes every time. Here is the source code, interested in a toss-up exchange. I hope this article will be of help to you.
Http://pan.baidu.com/s/1ntmolhZ
Wix Installation Deployment Tutorial (11)---Quickwix