I have a simple Solution for my Project, which works well. But I am unable to grasp how to make the Source paths relative. Can somebody help me?
<Component Id="Bla.exe" Guid="*"> <File Id="Bla.exe" Source="D:\Projects\Bla\Bla\bin\Debug\Bla.exe" KeyPath="yes" Checksum="yes"/> </Component>
How can I make the Path relative to the Wix Solution? WiX and all necessary files are in the same Solution.
A relative path is a path that describes the location of a file or folder in relative to the current working directory. It can be best used to refer to websites that are located on the same domain, ideally on certain sections of websites in which the documents never change relationships to each other.
An absolute path is defined as specifying the location of a file or directory from the root directory(/). In other words,we can say that an absolute path is a complete path from start of actual file system from / directory. Relative path. Relative path is defined as the path related to the present working directly(pwd) ...
You can use the relative path like so:
<File Id="Bla.exe" Source="..\bin\Debug\Bla.exe" KeyPath="yes" Checksum="yes"/>
OR
You can add a configuration file to your project to define common variables. To do so, add a new "WiX Include" file to your project, call it config.wxi. Then in your include file, you can define a SourceDir variable like so:
<?xml version="1.0" encoding="utf-8"?> <Include> <?define SourceDir = "D:\Projects\Bla\Bla\bin\Debug" ?> </Include>
Now in your .wxs file, you can add a reference to the config file at the top, ex:
<?xml version="1.0" encoding="UTF-8"?> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <?include "config.wxi"?>
Then just reference your SourceDir variable like so:
<File Id="Bla.exe" Source="$(var.SourceDir)\Bla.exe" KeyPath="yes" Checksum="yes"/>
Also, there are some built in WiX project variables that you may use.
There are many ways to do this but personally what I like to do is put my application installer projects in different solutions. I build the application solution first and use postbuild commands to publish the content to a deploy folder.
In my installer projects I set $(var.SourceDir)="..\deploy" and then $(var.SourceDir)\foo.exe for a source path.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With