First of all this is very similar to the issue addressed Custom Action in C# used via WiX fails with error 1154
However, I was not able to discern specific steps to solve the problem in my situation. Hopefully someone can point me in the right direction.
In my case I am using Wise Installation Studio 7.0 to execute a C# custom action I wrote to start the Server Manager Feature for .Net Framework 3.5 SP1 on Server 2008 R2 and newer.
I created the custom action in visual studio 2010 as a standard .Net 2.0 Class Library.
My guess is that I need to do something different here - that this needs to be compiled as something than a managed DLL. The code I am using is fairly straight forward ... taken from the flexera forums where someone else posted a solution to the .Net Framework 3.5 SP1 issue on Server 2008 R2.
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using Common_Functions;
namespace ActivateDotNetFramework
{
/**
* @brief helper library to activate .Net Framework on certain operating systems
*
* @args None
*
*
* @author Daniel Lee
* @date Jan 17,2012
* @version 1.0
* @bug 6540 Role Management tool required for 2008R2 to install .NET 3.5 SP1
**/
class ActivateDotNetFramework
{
static void Main(string[] args)
{
string logFile = "ActivateDotNetFeatures.log";
WriteToLog logWriter = null;
Process p = null;
ProcessStartInfo startInfo = null;
try
{
logWriter = new WriteToLog(logFile, "");
logWriter.UpdateLog("AMAZINGCHARTS! ActivateDotNetFramework Custom Action");
//open powershell process to activate the .net framework feature. See:
//http://community.flexerasoftware.com/archive/index.php?t-182914.html
startInfo = new ProcessStartInfo();
startInfo.FileName = "powershell.exe";
startInfo.Arguments = "Import-Module ServerManager ; Add-WindowsFeature as-net-framework";
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.UseShellExecute = true;
string sLogMsg = "";
p = new Process();
p.StartInfo = startInfo;
sLogMsg = "ProcessStartInfo Data ... ";
logWriter.UpdateLog(sLogMsg);
sLogMsg = "FileName: " + p.StartInfo.FileName + "\n Arguments:" + p.StartInfo.Arguments;
logWriter.UpdateLog(sLogMsg);
p.Start();
p.WaitForExit();
sLogMsg = "ActivateDotNetFramework Custom Action Return Code: " + p.ExitCode.ToString();
logWriter.UpdateLog(sLogMsg);
}
catch (Exception)
{
throw;
}
finally
{
}
}
}
}
Any ideas on how I should proceed with this in VS2010? Or is the issue in my Wise Installation Studio package CA configuration? As far as I can see VS2010 only builds the managed ActivateDotNetFramework.dll file and nothing else. I added this file to my resources in the wise package and listed the function name as ActivateDotNetFramework.
I have been around and around on this for over a day now. Any help is appreciated. Thanks.
Dan Lee AmazingCharts! Release Engineer