0

Setup is Wix 3.10.2 and visual studio 2015. Working with a wix setup project and custom action project.

I want to create a fragment containing the javados for my project. I had read here to set a pre-processor variable (or system variable). I opted to include the variable definition in the project. I tried the pre-processor var

<DefineConstants>JavaDocBase=c:\javadocs</DefineConstants>

and just setting a normal variable:

<WixVariables>JavaDocBase=c:\javadocs</WixVariables>

Neither ended up working.

Pre-Build event:

<PropertyGroup>
<PreBuildEvent>"$(WIX)bin\heat.exe" dir "$(var.JavaDocBase)" -cg JavaDocs_JSP -gg -scom -sreg -sfrag -srd -dr INSTALLDIR -var var.JavaDocBase -out "$(ProjectDir)\JavaDocs_JSP_Fragment.wxs"</PreBuildEvent>
</PropertyGroup>  

I always seem to receive the error:

Unhandled Exception:The expression """.JavaDocBase" cannot be evaluated. Method 'System.String.JavaDocBase' not found.

I have tried var.JavaDocBase, wix.JavaDocBase, env.JavaDocBase and Just JavaDocBase... while the last will allow the command to run, it doesn't put in the proper path so I am no further ahead.

Is it possible to replicate what is in that previously linked tutorial and if so, what have I done wrong?

Jon
  • 1,675
  • 26
  • 57

1 Answers1

0

Use it as property, instead of $(var.JavaDocBase) try $(JavaDocBase).

Also set property in the wixproj file.

<PropertyGroup>
  <JavaDocBase>c:\javadocs</JavaDocBase>
  <DefineConstants>$(DefineConstants);JavaDocBase=$(JavaDocBase)</DefineConstants>
</PropertyGroup>
Arkady Sitnitsky
  • 1,846
  • 11
  • 22
  • How do I add that property - can it be done from the visual studio gui or do I have to unload the project and hand-edit the wixproj file? Looks like it's defining it twice then, isn't it? Once as an xml tag and once as a pre-processor definition? – Jon Mar 09 '16 at 16:39
  • Yes you have to unload the project, the define part you can do or in the wixproj or the preprocessor definition. If you need i can post the code... – Arkady Sitnitsky Mar 09 '16 at 17:05
  • I don't seem to be able to make anything happen by setting JavaDocBase as a pre-processor definition... I did create a new property group and add that as a new property (with no PP-Def) and that worked, which I find puzzling and leaves me with a couple Q's: Why would the PP-Def method _not_ work? Possible to define this externally (in a file) soas to permit one location for configuration? – Jon Mar 09 '16 at 18:02
  • I did, but I don't understand the "why" of it. The tutorial I followed indicated that only the PP def was required (if not using an environment variable), which can be done via the gui, but it seems that that is not the case - a PP var is not required and a property in the project file is (required). Why would the PP def not work? – Jon Mar 14 '16 at 17:02
  • The PP you can set from GUI or to set it in the wixproj file as above, the result will be the same. The PP is used to pass properties from the wixproj to other wxs file, so you can use them in your code. The other property (JavaDocBase) is to set the harvesting directory and use it inside the heat command. Hope it helped you. Please up vote and mark as answered. – Arkady Sitnitsky Mar 14 '16 at 17:35
  • Last Q, I think. Why would the PP variable not have been usable/accessible in the pre-build event or in the heatdirectory task? – Jon Mar 14 '16 at 18:41