Open nazar-pc opened 9 months ago
Do you have a large number of DLLs? If it is less than a handful or some reasonable number to manually manage, then the heat.exe
utility is not needed, but each DLL will need to be explicitly defined in the WXS file.
Did you try the XML code in my comment here?
After executing the cargo wix init
command, there should be a wix\main.wxs
file in your project's source directory. Open the wix\main.wxs
file in your favorite text editor and add this XML snippet from my comment in the appropriate location in the main.wxs
file:
<!-- ... --->
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='$(var.PlatformProgramFilesFolder)' Name='PFiles'>
<Directory Id='APPLICATIONFOLDER' Name='project-name'>
<!-- In the most basic form, you can place the DLLs in the same
folder as the EXE; otherwise, put them in another folder. I just don't know the
DLL loading process for Rust EXEs. The DLLs may need to be in the same folder. -->
<Directory Id='Bin' Name='bin'>
<!-- ... --->
<!-- Repeat the next <component> block for each DLL making sure
the `Source` attribute is the path to the DLL and you change the ID
and Name accordingly. -->
<Component Id='gtk4' Guid='*' Win64='$(var.Win64)'>
<File
Id='gtk4Dll'
Name='gtk4.dll'
DiskId='1'
Source='target\gtk4\gtk4.dll'
KeyPath='yes'/>
</Component>
<!-- ... --->
</Directory>
</Directory>
</Directory>
</Directory>
<!-- ... --->
Can you provide a layout of your project structure and your wix\main.wxs
file?
I would recommend placing the DLLs in some location under your project structure, like a lib
, libs
, or dlls
directory instead of the target
directory. You will have to change the Source
attribute in the above XML to match the location, but the target
directory is for build artifacts and output by convention.
Do you have a large number of DLLs? If it is less than a handful or some reasonable number to manually manage, then the heat.exe utility is not needed, but each DLL will need to be explicitly defined in the WXS file.
There is 42 files right now and since they come from GTK4 that is evolving I have no guarantees set of files or their names will remain constant.
Did you try the XML code in https://github.com/volks73/cargo-wix/issues/76#issuecomment-522729742?
Not yet, I was looking for an automated way to not list all the files explicitly due to above mentioned reasons.
Can you provide a layout of your project structure and your wix\main.wxs file?
I would recommend placing the DLLs in some location under your project structure, like a lib, libs, or dlls directory instead of the target directory. You will have to change the Source attribute in the above XML to match the location, but the target directory is for build artifacts and output by convention.
Since I primarily want to do packaging in CI I create target/gtk4
and copy files there, so it is in fact an output for me, it is not in Git for sure.
There are https://github.com/volks73/cargo-wix/issues/161 and https://github.com/volks73/cargo-wix/issues/140, but they are not really that helpful, everyone is so cryptic about how to actually do it that I wasn't able to get it to work after spending hours.
What I have is an app that depends on GTK4. So I copied all DLLs into a separate directory
target\gtk4
, ran this command to getgtk4.wxs
:And then did
cargo wix --include .\target\gtk4\gtk4.wxs
and... nothing happened, meaning no DLLs were included, size of themsi
file is the same, zero errors with--nocapture
either.So the question still remains: how do I add DLLs to a package? I'd really appreciate some help since I'm thankfully not dealing with Windows almost at all and unfortunately have no experience with such tools.