-
I'm having a problem with passing quoted file paths in parameters for msbuild. In my .wixproj this code is present:
This is a "copy" from the dojo episode 12 I think. There are some 3121 files that need to be pulled in using the SourceFolder as the location. The project builds correctly in VS2022, which means the SourceFolder substitution is working as expected. Now, when building with msbuild, I need to pass the folder path using a property, which is done thus: msbuild -p:OutsideVersion=1.2.123;OutsideSourceFolder="C:\Workspace\90504_SmartCellConfigTool\Trunk\EMS Config Tool\bin\Release" The path must be quoted as shown because the path name contains spaces. Omitting the quotes gives an error, msbuild doesn't recognise the unquoted string with spaces and throws an error. However, when the msbuild command as shown is run, the file path substitution fails and I get 3121 errors of the ilk: C:\Workspace\90504_SmartCellConfigTool\Trunk\SetupSmartCellConfigTool\SetupSmartCell.wxs(10635): error WIX0150: Undefined preprocessor variable '$(var.SourceFolder)'. [C:\Workspace\90504_SmartCellConfigTool\Trunk\SetupSmartCellConfigT How can I resolve this problem (without having to rename may folder structure, which isn't a desired outcome as it reduces the versatility of the utility I am writing and want to be as general as possible). Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
This turns out to be a bit of a red-herring. The default path name and version should actually apply if no parameters are provided. But, if no parameters are entered, the build still fails with the same error! So for some reason the SourceFolder value is used when building the wixproj inside the VS2022 environment, but not when msbuild from the command line is used - same wixproj in both cases. Why? Why is the preprocessor not pushing the SourceFolder value to my second .wxs file? It seems as thought the Version number is getting used (in my Project.wxs file), but the SourceFolder is not being seen in my SetupSmartCell.wxs file? Is there some need for specifying in the source files that the preprocessor values must be included (either in the files or in the wixproj)? Can that be? |
Beta Was this translation helpful? Give feedback.
-
Thank you. The simplest answers are the best. I guess the correct way to do it is to use the -property: option to set the values for Configuration and Platform. |
Beta Was this translation helpful? Give feedback.
Did you check that MSBuild uses the configuration|platform you defined the constants for?
Or remove the propertygroup condition and try again.