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?
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
Targetelement with theNameattribute set toAfterBuildhas to be added to theProjectelement of the wixproj file. To copy files, specify oneCopyelement for each file you want to copy to your output folder. Place theCopyelements within yourTargetelement. Read about theCopysyntax here. A lot more can be done with MSBuild, so have a look at the reference.