I am using WixSharp v1.9.2.0 to build an MSI file, but when I call the project.BuildMsi() method, WixSharp creates temporary files in the %Temp% folder of Windows. However, my project is quite large, and soon my C drive is full, causing the MSI creation to fail.
Is there a way to change the folder that WixSharp uses for its temporary files? If so, how can I do that?
Wix# using standard
Path.GetTempPath&Path.GetTempFileNamemethods to get location for temp files.Per the documentation these methods checks for the existence of environment variables in the following order and returns the first path found:
TMPenvironment variable.TEMPenvironment variable.USERPROFILEenvironment variable.So, you can change the temp folder location by changing
TMPenvironment variable for the project during the build and msi authoring.To do so you need to add the following into your wix# csproj (tested for sdk-style project)
Here we can see:
SetEnvironmentVariableTaskinline task which executes the C# code specified inside aCodenodeSampleTargettarget which is called before wix#MSIAuthoringtarget and callsSetEnvironmentVariableTaskto set%tmp%to theD:\temp\.Notes:
%temp%folder before authoring msi. You can do this manually or add appropriate code into theMainbefore any wix# actions.MSIAuthoring(source) which is subject to change on the wix#-side. So, you need to control this aspect on every wix# update and update your code accordingly.