Skip to content

Instantly share code, notes, and snippets.

@mesarvagya
Created December 4, 2014 16:48
Show Gist options
  • Save mesarvagya/82de65408d5f7fddf681 to your computer and use it in GitHub Desktop.
Save mesarvagya/82de65408d5f7fddf681 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Deployment.WindowsInstaller;
namespace SetupCAInstallFolder
{
public class CustomActions
{
[CustomAction]
public static ActionResult InstallFolderFinder(Session session)
{
session.Log("Here is the SetupCAInstallFolder");
string path = session.CustomActionData["INSTALLEDPATH"];
session.Log("Original Installed Path is " + path);
path = path.Replace(@"\", @"\\");
session.Log("New Installed Path is " + path);
try
{
System.IO.Directory.CreateDirectory("C:\\tempdir");
}
catch (Exception e)
{
session.Log(e.ToString());
}
System.IO.File.WriteAllText("C:\\tempdir\\" + "installed.txt", path);
session.Log("Written in the file OK");
return ActionResult.Success;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment