views:

495

answers:

2

hi in my .wxs file the File tag Source attribute, the path has a spaces in it.

<File Id="_uploads.UserImport.EDS_UserImport.xls" Name="EDS_UserImport.xls" Source="C:\**Documents and Settings**\kle\Desktop\OspreyMSIGenerator\OspreyMSIGenerator\Published\EDSContainer\uploads\UserImport\EDS_UserImport.xls"></File>

i get this error candle.exe : error CNDL0103 : The system cannot find the file 'and' with type 'Source'.

thing is I cant be sure that my paths wont have spaces in it. How do i support spaces in the Source path?

+2  A: 

Try upgrading to the latest stable wix release (currently 3.0.x). I tested this with Wix 3.0.5419.0 and file paths with spaces are accepted without errors.

On a related note: File elements should not contain absolute paths like in your example, because you would only be able to build the setup on a single developer's PC. Use paths relative to the location of the wxs file instead, like this:

<File Source="..\bin\foo.exe" />

Or make use of a variable that contains the location of the files like this:

<File Source="$(var.BinFolder)foo.exe" />

You can then pass the location of the bin folder by invoking candle like this:

candle.exe -dBinFolder=c:\someFolder\bin\ foo.wxs
Wim Coenen
+1  A: 

@wcoenen provides one mechanism. However, I prefer to use the light.exe -b switch. Then your code can look like:

<File Id="_uploads.UserImport.EDS_UserImport.xls" Name="EDS_UserImport.xls" Source="SourceDir\Published\EDSContainer\uploads\UserImport\EDS_UserImport.xls"></File>

and your command-line to light.exe would have:

-b "C:\Documents and Settings\kle\Desktop\OspreyMSIGenerator\OspreyMSIGenerator"

You can have multiple -b switches and greatly reduce the complexity of your Source attribute.

Also, the File/@Id and File/@Name can be left off if you are find with them defaulting to the file name (in this case, "EDS_UserImport.xls").

Rob Mensching
+1, makes everything much less complex. Unfortunately the WiX documentation doesn't appear to explain the link between using -b for light and using "SourceDir" in File/@Source.
sascha
I am really confused about "SourceDir" now, as apparently it has 3 different meanings: 1) magic value that you have to use in `<Directory Id='TARGETDIR' Name='SourceDir'>` 2) Windows installer property that points to the folder containing the installation package 3) Special value set with `light.exe -b` that you can use as "<File Source='SourceDir\...'>". Argh!
Wim Coenen
The first two are the same thing. The third option uses SourceDir because the Source inherits it's values from the parent Directory elements and the File/@Name. A lot of people just got in the habit of always specifying the File/@Source instead of using the default.
Rob Mensching