Frage

I am trying to create an installer with WiX Toolset v3.7.1224.0 that can be used with different configurations. I already have a working installer that I built with Votive in VS2010. The installer creates an MSSQL-database with the help of the WixSqlExtension.

After the databse has been created and all the tables have been specified, I want the installer to initialize the tables with some values. At the moment these values are compiled into the msi as SqlString elements. I want to externalize these strings into a configuration file. The configuration file will store strings that get inserted into the SqlString table temporarily using the InsertTemporary() method and the SOURCEDIR property in a customaction. I have not yet decided on the format of the configuration file, but it will be either an xml file or a simple text file in which each sql string is on its own line, or in its own element respectively, so I can parse the file and add a temporary record for each entry in the file.

I would like to integrate this configuration file into my project structure. It should get copied into the output directory of the project but it should not be installed on the end user's computer. I thought that I could accomplish this by adding the file to my project and then changing the Advanced properties of the file in Votive. I specified the "Build Action" to be "Content" and the "Copy to Output Directory" to be "Always". But when I build the project, the file is not present in the output directory of the project. At best I would like to also be able to add a directory containing multiple configuration files to the project output directory.

Is there any way I can achieve this with Votive and Wix? Is this possible with MSBuild? How would I have to modify the .wixproj file to create the directory and the files?

War es hilfreich?

Lösung

Indeed, the solution is to modify the wixproj file for that project. Wix uses MSBuild, a very brief description of the WIX target for MSBuild can be found here. To edit the wixproj file within Visual Studio, open the context menu of the Wix project and unload it. Open the context menu of the unloaded project and select edit projectname.wixproj.

To Copy files after the project has been compiled, a new Target element with the Name attribute set to AfterBuild has to be added to the Project element of the wixproj file. To copy files, specify one Copy element for each file you want to copy to your output folder. Place the Copy elements within your Target element. Read about the Copy syntax here. A lot more can be done with MSBuild, so have a look at the reference.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top