A.Pissicat
A.Pissicat

Reputation: 3265

Wix link to a file

I working on wix for a c# project.

In my solution I have a folder "Requirements" containing a pdf file and a ttf file :

enter image description here

In my setup I want to install the new font font.ttf and copy the pdf (containing the documentation) in my INSTALLFOLDER. In my wix setup, I created a folder "Requirements" and added my 2 files as link. Both files are visible in my folder.

In my setup I have this part of code :

<DirectoryRef Id="FontsFolder">
  <Component Id="InstallFonts" Guid="{***}" Permanent="yes">
    <File Id="font.ttf" Source="Requirements\font.ttf" TrueType="yes" />
  </Component>
</DirectoryRef>

And a similar thing for my pdf.

But when I build my setup I have this error :

The system cannot find the file 'Requirements\user_manual.pdf'.
The system cannot find the file 'Requirements\font.ttf'.

How can I use theses files as link ?

Upvotes: 2

Views: 518

Answers (2)

Mainpat
Mainpat

Reputation: 81

use the $(var.SolutionDir) variable from wix. Delete the link from the setup project and use the origin file vom the Requirements folder.

<DirectoryRef Id="FontsFolder">
  <Component Id="InstallFonts" Guid="{***}" Permanent="yes">
    <File Id="font.ttf" Source="$(var.SolutionDir)Requirements\font.ttf" TrueType="yes" />
  </Component>
</DirectoryRef>

Upvotes: 1

Morgosus
Morgosus

Reputation: 827

Well, I tried to do something: Base folder

Solution
    Requirements
        Vampire.xlsx <- This one is Drag and dropped from desktop
        Script1.js <- This one is created in the folder (Right click, add)

Vampire.xlsx has the path: D:\Users\Morgo\Desktop\Vampire.xlsx
Script1.js has the path: D:\Users\Morgo\Documents\Visual Studio 2017\Projects\Testing field\Script1.js

This suggest that if you created the files in your folder by adding a new item, their path would probably not be Requirements\font.ttf, but only font.ttf If you added them from elsewhere, they most likely retain their original path and source would be that.

My advice: Check the path of your files

.

Upvotes: 1

Related Questions