2012-01-19 4 views
0

먼저 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보다 컴파일해야 할 필요가 있습니다. 제가 사용하고있는 코드는 상당히 간단합니다 ... 다른 사람이 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로 나열했습니다.

저는 하루 전 이상이었습니다. 어떤 도움을 주셔서 감사합니다. 감사.

댄 리 AmazingCharts! 릴리스 엔지니어

답변

1

해당 코드는 EXE로 컴파일되어 EXE 사용자 지정 동작으로 실행되어야합니다. 그러나 더 큰 질문은 왜 전혀 귀찮은 것입니까? 당신이 기능을 설치하려면 Windows에서 할 일은 호출입니다 : 기능 이름의 목록은

DISM/온라인/사용 - 기능 FeatureName

을 입력 :

DISM/온라인/가져 오기 - 특징