這一切首先是非常相似的問題解決Custom Action in C# used via WiX fails with error 1154自定義操作使用明智的安裝Studio時返回實際的錯誤代碼1154 7.0
但是,我無法分辨具體的措施來解決在我的情況的問題。希望有人能指出我正確的方向。
在我的情況下,我使用Wise Installation Studio 7.0來執行我寫的C#自定義操作,以啓動Server 2008 R2及更新版本上的.Net Framework 3.5 SP1的服務器管理器功能。
我在visual studio 2010中創建了自定義動作作爲標準.Net 2.0類庫。
我的猜測是,我需要在這裏做一些不同的事情 - 這需要編譯爲託管DLL之外的東西。我使用的代碼非常簡單...從flexera論壇中獲得,其他人在Server 2008 R2上發佈.Net Framework 3.5 SP1問題的解決方案。
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
{
}
}
}
}
關於如何在VS2010中繼續使用這個任何想法?或者是我的Wise Installation Studio軟件包CA配置中的問題?據我所見,VS2010只構建受管理的ActivateDotNetFramework.dll文件,而不是其他任何東西。我將這個文件添加到智能包中的資源中,並將函數名稱列爲ActivateDotNetFramework。
我一直在這附近和附近一整天。任何幫助表示讚賞。謝謝。
丹李 AmazingCharts! 版本工程師