2013-05-20 5 views
5

CodeProject의 코드는 Windows shell extension tutorial입니다.WiX에 해당하는 "Regasm.exe my.dll/codebase"?

컴파일, 실행 Regasm.exe CSShellExtContextMenuHandler.dll /codebase 및 셸 확장을 사용할 수 있습니다, 그것은 잘 작동합니다.

그러나 사용자에게 Regasm을 실행하도록 요청하는 것은 사용자에게 친숙하지 않으므로 아래에있는 작은 WiX 스크립트를 작성했습니다. (단지 heat의 출력과 함께 사용하려는 종속성 DLL을 복사했습니다.)

문제 : 나는 결과 MSI를 설치하면 (이 Regasm 작업에도 불구하고, 내 항목을 표시하지 않습니다 Windows 탐색기에서 파일을 마우스 오른쪽 버튼으로 클릭에)는, 쉘 확장이 표시되지 않는

<?xml version='1.0' encoding='windows-1252'?> 
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'> 

    <Product Name='HelloWorld Shell Extension' Id='2afd44ab-16d7-40f4-8741-69ad546cb7cf' UpgradeCode='c5139d19-21ba-43c6-a17d-68760331f332' 
    Language='1033' Codepage='1252' Version='0.4.4' Manufacturer='Me'> 

    <Package Id='*' Keywords='Installer' Description="HelloWorld Shell Extension Setup" Manufacturer='Me' 
     InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' /> 

    <Media Id='1' Cabinet='HelloWorldShellExtension.cab' EmbedCab='yes' DiskPrompt='HelloWorld CAB' /> 
    <Property Id='DiskPrompt' Value="HelloWorldShellExtension Bundle CAB Installation" /> 

    <Directory Id='TARGETDIR' Name='SourceDir'> 
     <Directory Id='ProgramFilesFolder' Name='PFiles'> 
      <Directory Id='INSTALLDIR' Name='HelloWorldShellExtension'> 
      <Component Id="cmpB0970E4FB9610FC20E1C6B6B2D45C606" Guid="7044db96-17d3-4d4f-93b0-135b89b042c8"> 
       <Class Id="{CE43A2AB-B457-49BF-C83F-4306208D438B}" Context="InprocServer32" Description="CSShellExtContextMenuHandler.FileContextMenuExt" ThreadingModel="both" ForeignServer="mscoree.dll"> 
        <ProgId Id="CSShellExtContextMenuHandler.FileContextMenuExt" Description="CSShellExtContextMenuHandler.FileContextMenuExt" /> 
       </Class> 
       <File Id="fil5B7C752C5541C807852A6781921F95AB" KeyPath="yes" Source="bin\CSShellExtContextMenuHandler.dll" /> 
       <RegistryValue Root="HKCR" Key="*\shellex\ContextMenuHandlers\{ce43a2ab-b457-49bf-c83f-4306208d438b}" Value="CSShellExtContextMenuHandler.FileContextMenuExt Class" Type="string" Action="write" /> 
       <RegistryValue Root="HKCR" Key="CLSID\{CE43A2AB-B457-49BF-C83F-4306208D438B}\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" Value="" Type="string" Action="write" /> 
       <RegistryValue Root="HKCR" Key="CLSID\{CE43A2AB-B457-49BF-C83F-4306208D438B}\InprocServer32\1.0.0.0" Name="Class" Value="CSShellExtContextMenuHandler.FileContextMenuExt" Type="string" Action="write" /> 
       <RegistryValue Root="HKCR" Key="CLSID\{CE43A2AB-B457-49BF-C83F-4306208D438B}\InprocServer32\1.0.0.0" Name="Assembly" Value="CSShellExtContextMenuHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=73df467e0a99a326" Type="string" Action="write" /> 
       <RegistryValue Root="HKCR" Key="CLSID\{CE43A2AB-B457-49BF-C83F-4306208D438B}\InprocServer32\1.0.0.0" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" /> 
       <RegistryValue Root="HKCR" Key="CLSID\{CE43A2AB-B457-49BF-C83F-4306208D438B}\InprocServer32\1.0.0.0" Name="CodeBase" Value="file:///[#fil5B7C752C5541C807852A6781921F95AB]" Type="string" Action="write" /> 
       <RegistryValue Root="HKCR" Key="CLSID\{CE43A2AB-B457-49BF-C83F-4306208D438B}\InprocServer32" Name="Class" Value="CSShellExtContextMenuHandler.FileContextMenuExt" Type="string" Action="write" /> 
       <RegistryValue Root="HKCR" Key="CLSID\{CE43A2AB-B457-49BF-C83F-4306208D438B}\InprocServer32" Name="Assembly" Value="CSShellExtContextMenuHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=73df467e0a99a326" Type="string" Action="write" /> 
       <RegistryValue Root="HKCR" Key="CLSID\{CE43A2AB-B457-49BF-C83F-4306208D438B}\InprocServer32" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" /> 
       <RegistryValue Root="HKCR" Key="CLSID\{CE43A2AB-B457-49BF-C83F-4306208D438B}\InprocServer32" Name="CodeBase" Value="file:///[#fil5B7C752C5541C807852A6781921F95AB]" Type="string" Action="write" /> 
      </Component> 
      <Component Id='Libraries' Guid='f982a0bb-824d-4835-921d-e51b47b8598b'> 
       <File Id='dependency.dll' Name='dependency.dll' Source='bin\dependency.dll' DiskId='1' /> 
      </Component> 
     </Directory> 
     </Directory> 
    </Directory> 

    <Feature Id='HelloWorldShellExtensionFeature' Title='HelloWorld' Description='HelloWorld' Level='1' AllowAdvertise='no'> 
     <ComponentRef Id="cmpB0970E4FB9610FC20E1C6B6B2D45C606" /> 
     <ComponentRef Id="Libraries" /> 
    </Feature> 

    <UI> 
     <UIRef Id="WixUI_InstallDir" /> 
    </UI> 

    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" /> 
    </Product> 
</Wix> 

Regasm이 실제로 설치하는 키를 모방하기 위해 Root="HKCR" Key="[...]"Root="HKLM" Key="SOFTWARE\Classes\[...]"으로 변경하려고했으나 작동하지 않습니다.

답변

4

먼저 사용중인 CLSID가 원래 예제 소스와 다릅니다. 아마도 그것을 자신의 것으로 만들기 위해 편집했을 것입니다. FileContextMenuExt 클래스의 특성과 동일한 값을 사용하고 있는지 확인하십시오.

WiX의 heat.exe가 codebase 요소를 지원하지 않는 것 같습니다. 아마도 전제 조건은 컴퓨터 전체에서 COM 어셈블리를 등록 할 때 전체 어셈블리 위치 (즉, GAC)에 배치한다는 것입니다. 그렇게하면 코드베이스가 필요하지 않습니다.

heat file ...은 코드베이스 요소를 제외한 모든 것을 생성하지만 손으로 ​​입력했습니다. 다른 필수 등록 항목 인 *\shellex\ContextMenuHandlers도 있습니다. 응용 프로그램 특정 요소이므로 생성 할 수 없습니다. 그러나, 당신은 또한 그것을 손으로 입력했습니다.

마지막으로 설치 프로그램과 explorer.exe는 동일한 "비트"를 가져야합니다. 그렇지 않으면 설치 프로그램이 64 비트 explorer.exe에서 볼 수없는 32 비트 explorer.exe에 대한 레지스트리 항목을 만들 수 있습니다. 제품을 배포하려면 설치 프로그램의 x86 및 X64 빌드가 있어야합니다. 패키지의 플랫폼을 Wix/Product/Package 요소에 명시 적으로 설정할 수 있습니다.

이외에 Product.wxs은 "내 컴퓨터에서 작동합니다."