Question

I have a GUI generated using wxpython which is used to select the path required by wix project to create msi. The selected path from the GUI is written to the registry when clicked on apply button in the GUI.The selected path is stored in a variable say data i.e:

data='C :\Sandbox\build\Windows\release\my.exe

as well as written to registry i.e:

HKEY_CURRENT_USER\Software\Automation\myapp

Now i have wix project developed to create msi using msbuild. I want the selected path in the GUI has to go into the source path in wix component. My wix code somewhat like below,

<Component Id='MainExecutable' Guid='*'>
    <File Id='ExecutableFile' Name='my.exe' DiskId='1' Source='$(var.Sandbox)\my.exe' KeyPath='yes' Checksum='yes'/>
</Component>

With above code, I get an error saying,

 error CNDL0150: Undefined pre processor variable '$(var.Sandbox)'

How can i pass the variable 'data' which is selected by the GUI to the file source path in wix?Is it possible to send the registry value to wix?

Was it helpful?

Solution 2

Pass the variable 'data' from the python script to wix as a msbuild property.Python script looks like below

data='C:\Sandbox\build\Windows\release\my.exe'
arg1 = '/t:Rebuild'
arg2 = '/p:Configuration=Release'
arg3 = '/p:Platform=x86'
arg4 = '/p:ExePath=data'
p = subprocess.call([self.msbuild,projpath,arg1,arg2,arg3])

and the make changes in your wixproject like below.

<PropertyGroup>
    <DefineConstants>
    Sandbox=$(ExePath)
    </DefineConstants>
</PropertyGroup>

and in your wxs file change the source path of your component as below

<Component Id='MainExecutable' Guid='*'>
<File Id='ExecutableFile' Name='my.exe' DiskId='1' Source='$(var.Sandbox)\my.exe' KeyPath='yes' Checksum='yes'/>       
</Component>

OTHER TIPS

When you call candle.exe you need to pass the data variable through via a preprocessor variable named Sandbox. You do that with a snippet line that looks something like:

from subprocess import call
call(["candle.exe", "-dSandbox=" + data])

Of course, you'd need to add the path to your .wxs file and all that too.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top