How do I work with spaces in my wix source path?

∥☆過路亽.° 提交于 2020-01-01 10:09:31

问题


wxs file the File tag Source attribute; the path has a space 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'.

I can't be sure that my paths won't have spaces in it. How do I support spaces in the Source path?


回答1:


Try upgrading to the latest stable wix release. 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

edit: as shown by Rob in his own answer, you can also use the light.exe -b switch to specify one or more base directories where the files to install can be found.




回答2:


@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").



来源:https://stackoverflow.com/questions/1811035/how-do-i-work-with-spaces-in-my-wix-source-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!