File

Installing files is probably the most common task when creating installers. Best practice is to add only one file per component. Windows Installer can handle thousands of components within one installer without any problems. Note that each component must have a unique Id and Guid!

For file-resources in your project you can set the Source-attribute to the file-path.

<Component Id="CMP_YourComponent" Guid="<YourGuid>">
	<File Id="YourFile.exe" 
		  Source="SourcePath\YourFile.exe" 
		  KeyPath="yes" />
</Component>

Referencing a Visual-Studio project

If you are using Votive, you should not hardcode the filepath. Instead, you can reference your project by using the variable $(var.<YourProjectName>.TargetPath). These are the detailed steps:

  • In your Setup-Project add a reference to the project you want to include.
  • Use the TargetPath-variable of your project in the Source:
    <Component Id="CMP_YourComponent" Guid="<YourGuid>">
    	<File Id="YourCompany.YourLibrary.dll" 
    		  Source="$(var.YourProjectName.TargetPath)" 
    		  KeyPath="yes" />
    </Component>