Here is an example:
Code: Select all
[CustomAction]
public static ActionResult UpdateConfigPaths(Session session)
{
// Get values from session data
string installPath = session["APPDIR"];
string connPath = session["CONFIGDIR"];
// Log values
session.Log("UpdateConfigPaths BEGIN");
session.Log("installPath: " + installPath);
session.Log("connPath: " + connPath);
This is 100% good so far.UpdateConfigPaths BEGIN
installPath: C:\Program Files (x86)\myInstallPath\myProgram\
connPath: C:\Program Files (x86)\myInstallPath\myProgram\Configuration
Later I use the `installPath` variable to loop through directories, which works. But I try to update a string inside a config file with the value `connPath` and I get the following:
Code: Select all
itemElement.SetAttributeValue("file", string.Format(@"{0}\AppSettings.config", connPath));I have no idea why it is replacing `C:\Program Files (x86)\myInstallPath\myProgram\` with `[APPDIR]`.<appSettings file="[APPDIR]\Configuration\AppSettings.config">
Can anyone tell me what I'm doing wrong here?
FOLLOW US
Get the latest news in Application Packaging