2010-06-29 6 views
0

VS2010 및 WIX 3.5를 사용하고 있습니다.WIX C# CustomAction, 내가 뭘 잘못하고 있니?

1) WIX 설치 프로젝트를 만들었습니다.

2) 그럼 난 솔루션 C# 사용자 지정 작업 프로젝트에 추가하고 '의 CustomActions'

namespace CustomActions 
{ 
    public static class CustomActions 
    { 
    [CustomAction] 
    public static ActionResult CustomAction1(Session session) 
    { 
     Debugger.Break(); 
     MessageBox.Show("It works"); 
     session.Log("Begin CustomAction1"); 
     return ActionResult.Success; 
    } 
    } 
} 

3) 그럼 난 컴파일의 CustomActions 프로젝트를 불러 내 ​​설치 프로젝트에서 참조를 추가했습니다.

4) 그리고 마지막으로 .wxs 파일에 넣어 : 작동하지 않습니다

<Binary Id="CustomActions" SourceFile="$(var.CustomActions.TargetDir)$(var.CustomActions.TargetName).CA.dll"/> 

<CustomAction Id="CustomAction1" BinaryKey="CustomActions" DllEntry="CustomAction1" Execute="immediate" /> 

. 내가 도대체 ​​뭘 잘못하고있는 겁니까? 도와주세요.

답변

1

당신은 또한 당신이 알고 있어야

<InstallUISequence> 
     <Custom Action="CustomAction1" After="AppSearch"/> 
    </InstallUISequence> 

실행하려면 사용자 지정 작업을 예약해야 할 일을 많이 MSI는 샌드 박스 제한에서 실행하는. MessageBox.Show 호출이 작동하지 않는다고 생각합니다. 대신 세션 로깅에 의존해야합니다.

+0

System.Windows.Forms 네임 스페이스를 참조하고 'Using System.Windows.Forms'지시문을 추가 한 경우 MessageBox.Show()를 호출하면 작동합니다. – Mario

+0

나는이 테스트를 실시했으며 실제로 그렇게 보입니다. 일하다. 나는 그 좋은 생각을 믿지 않지만, 어떤 방식 으로든 그 일을 끝내게됩니다. :) –

+0

메시지를 표시하려면 session.Message를 사용해야합니다. 그렇지 않으면 메시지 상자가 더 코딩하지 않고도 맨 위에 표시 될 것이라고 보장 할 수 없습니다. –

관련 문제