SharpDevelop WIX project: MSBuild Configurations

Posted by chezy525 on Stack Overflow See other posts from Stack Overflow or by chezy525
Published on 2011-01-13T20:06:55Z Indexed on 2011/01/13 21:53 UTC
Read the original article Hit count: 244

Filed under:
|
|

Using SharpDevelop, I wrote a windows service with a WIX setup project to install/auto-start it. For testing purposes, I've done a number of things I don't want to do in the release version (i.e. add an uninstall shortcut to the desktop). So, my question really boils down to this; how do you handle build configurations within a WiX project?

I think I've solved most of my problems after I found this question Passing build parameters to .wxs file to dynamicaly build wix installers. And thus far I've done the following:

Added a property that checks the Configuration variable

<Product>
  ...
  <Property Id="DEBUG">$(var.Configuration) == 'Debug'</Property>
  ...

Separated all of the debug files into unique components and setup as a separate feature with a condition checking the DEBUG property.

<Product>
  ...
  <Feature>
    ...
    <Feature Id="DebugFiles" Level="1">
      <ComponentRef Id="UninstallShortcutComponent" />
      <Condition Level="0">DEBUG</Condition>
    </Feature>
    ...

Then, finally, pointing to the correct file based on the configuration, using the Configuration variable

<Directory>
  ...
  <Component>
    <File Source="..\mainProject\bin\$(var.Configuration)\main.exe" />
  </Component>
  ...

So, now my question is simplified to how to handle files that may not exist under certain build configurations (like .pdb files). Using all of the above (including pointing the file source to the ...\bin\Release\*.pdb, which I know isn't expected to exist) I get a LGHT0103 compiler error, it can't find the file.

© Stack Overflow or respective owner

Related posts about msbuild

Related posts about wix