First of all I needed to create an Installer Class in the app, and then override the Install method like so, capturing an input parameter and writing it to a text file:
public override void Install(IDictionary savedState) { base.Install(savedState); string version = Context.Parameters["Version"]; string path2 = "C:\\MyFile.txt"; try { FileStream fs1 = new FileStream(path2, FileMode.OpenOrCreate, FileAccess.Write); StreamWriter writer1 = new StreamWriter(fs1); writer1.Write("Version:" + "\r\n" + version); writer1.Close(); } catch (Exception) { //do something here if you need to } }Then, in the Setup project, I added Custom Action. Right-click on the project, go to View > Custom Actions. Right-click on the install folder, and select Add Custom Action. Browse to the Application folder, select the primary output, and click 'Add Output'. Then, select the thing you've just added, and in the properties window, do the following: