WIX HeatDirectory Task - Setting the preprocessorVariable

后端 未结 6 1221
难免孤独
难免孤独 2020-12-24 15:32

I\'m trying to set the preprocessor variable in wix and i\'m unable to find an example of this or explanation on how to do it anywhere on the internet, i\'m hoping somebody

6条回答
  •  一生所求
    2020-12-24 15:54

    I have a very large installer kit to build in Visual Studio 2013 (includes some tools related to the main project, a windows service and a web application with a non-trivial directory structure). I'm still learning how to use WiX, and am still crafting, testing and refining the WiX project. Currently, I have the harvest tasks set up as build events, using a command of the form

    "C:\Program Files (x86)\WiX Toolset v3.9\bin\heat.exe" dir "$(SolutionDir)\MyProjectDir\bin\$(ConfigurationName)" -cg MyComponentRef -ag -dr MYINSTALLDIR -srd -wixvar -var var.MySourceFiles -sreg -out "$(SolutionDir)\Deployment\My Installer Project\ComponentList.wxs" -t "$(SolutionDir)\Deployment\My Installer Project\FileFilter.xslt"

    This command just grabs all the files in the project's bin\Debug (or bin\Release) folder, then filters it using an xml stylesheet transform. There are quite a few harvests to gather like this, so maintaining all the source file variables (the "var.MySourceFiles" argument in the command) was becoming tedious and error prone. Initially, I had added the declarations to the project's preprocessor variables, but I wanted something that was a little more "self-contained". Using the helpful tips I found at WiX tricks and tips, I declared a new include file, "PreprocessorVars.wxi" with content

    and got the xslt to include it in the output generated by heat.exe with the snippet

        
            $(sys.CURRENTDIR)\PreprocessorVars.wxi
        
    

    The xslt now produces output that looks something like this:

    
        
            
            
                
            
            
                
                    
                        
                    
                
            
        
    

    which Wix processes without any errors.

提交回复
热议问题