Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Setup projects and build events
 

Setup projects and build events

I have several config files in a project:

file.xml
file.systest.xml
file.live.xml

I use build events to modify this set and output the correct one when the project builds. For example, in a SYTEST build I overwrite file.xml with file.systest.xml, then delete file.systest.xml and file.live.xml. This works perfectly.

When I come to build my MSI using a setup project however, I find that the files copied are actually from the project directory, rather than the relevant build directory - meaning the default file (file.xml) is taken directly and has the wrong value.

I would expect the setup project to take files from a build directory.

So I tried using build events for my setup project which also works provided I output loose files.

When I output an MSI I get the original file again.

Any ideas?

How can I run a batch file after installation?

<bb />
ben.biddington  Thursday, May 31, 2007 3:09 PM

Does the build folder change for each build, or are there simply 3 folders (1 for each build) that are always the same?

If the build folder paths are constant, one way you might be able to make this work is to always add all 3 files to your setup and create a Condition for each that is dependent on the build. Then when the setup is installed, the user would need to pass in the build type.

If that's not an option and you really only want one File entry in the setup project that could be any of 3 options, thenyou could right some code to dynamically modify the .vdproj file before building the setup. The SourcePath and TargetName properties of the File would need to be modified. Parsing that file could be tricky because it is not XML.

Matt Smith MSFT  Monday, June 04, 2007 11:15 PM

How were this xml files added to your setup project? Through a content project output group?

Since you seem to be able to handle the postbuild events to copy these files to the output directory, why don't you add to your post-build step to also install to a static directory (i.e. one that dosn't change when the config changes. For example, you could create an "Installer Files" directory under your primary project and dump the files in there). You could then add a file at this location directly to your setup project.

Mike Wade - MSFT  Wednesday, June 06, 2007 1:01 AM

You can use google to search for other answers

Custom Search

More Threads

• Where is my Executable
• Custom Actions: FolderBrowserDialog not working properly
• Number of Days difference between 2 dates..
• Set up and Deployment project using xml file
• Setup needs to uninstall previous
• vdproj project file schema or alternate solution
• Looking for Tutorial
• How to disable next button in msi if textbox has invalid/no value???
• Installer Problem for program
• Sql express prerequisistes - Microsoft direct link