2012-01-19 9 views
0

まずCustom Action in C# used via WiX fails with error 1154カスタムアクションは、ワイズインストーラStudioを使用したときに実際のエラーコード1154が返さ7.0このすべての

は、しかし、私は私の状況で問題を解決するための具体的な手順を識別することができませんでした対処の問題に非常によく似ています。うまくいけば、誰かが正しい方向に私を指すことができます。

私の場合、Wise Installation Studio 7.0を使用して、Server 2008 R2以降で.NET Framework 3.5 SP1用のサーバーマネージャー機能を開始するために書いたC#カスタムアクションを実行しています。

ビジュアルスタジオ2010でカスタムアクションを標準.NET 2.0クラスライブラリとして作成しました。

ここで私は別の何かをする必要があると思います。これは、管理されたDLLよりもコンパイルする必要があります。私が使用しているコードはかなり簡単です...他の誰かがServer 2008 R2の.Net Framework 3.5 SP1の問題を解決したflexeraフォーラムから取得しました。

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としてリストしました。

私はこれで1日以上周りにいました。どんな助けもありがとうございます。ありがとう。

ダンリー AmazingCharts! リリースエンジニア

答えて

1

このコードはEXEとしてコンパイルし、EXEカスタムアクションとして実行する必要があります。しかし、私のもっと大きな疑問は、なぜ全く気にしないのでしょうか?この機能をインストールするには、Windowsにしなければならないのは、呼び出しです:機能名の一覧について

DISM /オンライン/有効-機能FEATURENAME

は、入力します。

DISM /オンライン/取得-機能

関連する問題