[wix-users] Undefined preprocessor error but only on the jenkins build server

Shawn Fox shawn.fox at gobio.com
Wed Jan 3 17:01:54 PST 2018


Since I changed my installer to use variables for target paths instead of relative paths, my build started to fail but only when running msbuild on the Jenkins build server.  The error looks like this, with MyProject substituted with my actual project name.

Product.wxs

error CNDL0150: Undefined preprocessor variable '$(var.MyProject.TargetPath)'.

Build FAILED.

I build successfully on my development computer with Visual Studio or by executing the exact same msbuild command that the build server runs.  However, the build fails on the build server due to the use of the TargetPath.  It turned out that adding references to my project file via visual studio was resulting in a strange relative path being stored into the .wixproj file.  It had to do with the way that the SVN checkout was done differently coupled with the fact that the relative path used was a ../../directory/project.dll instead of ../project.dll which would have been fine.  I'm not sure why but for that one project reference, visual studio insisted on putting the extra ../directory into the path instead of putting in the shortest possible relative path.  On the build server it wasn't possible to go backwards that far so ../../directory simply didn't exist as it did on my build machine.  It appears that Visual Studio or Wix always wants to assume that the .csproj file is in a sub-folder with the project name.  In this case my project just happened to be in the solution folder.

It just so happened that my local checkout path using svn was one directory longer than what I used in the Jenkins config.  I'm not sure if that is explanation is clear or not but it appears that the issue is that the wix project file is sometimes updated with an unnecessarily long relative path that drops back too many levels.  The project reference in question was only one folder back from where the wix project was so in my mind the reference should have been ../project.dll and not ../../projectname/project.dll

The project in question was the first project created when the solution was created so it happened to be put into the solution directory, but some other projects were created in sub-folders.  Is this behavior expected and necessary or has it been changed in later versions?  I'm currently using Visual Studio 2015 and Wix 3.7.1224.0.  This was difficult to troubleshoot due to the fact that it worked locally but not on the build server so the behavior seems undesirable to me.

Shawn Fox



________________________________

This email, including any attachments and files transmitted with it, are for the sole use of the intended recipient(s) to whom this email is addressed, and may contain confidential and/or privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please be advised that you have received this email in error, and please contact the sender by reply email and destroy all copies (including all electronic and hard copies) of the original message. Thank you.


More information about the wix-users mailing list