2012-06-29 8 views
5

Ho C# COM .dll. Vorrei installare la .dll una volta, ma è necessario registrarla sia per x86 che per x64.WiX: registro componente COM .NET sia x86 x64

Ecco il WiX ho per la registrazione solo x64:

<Component Id="NETDLL.dll" Directory="INSTALLDIR"> 
    <File Id="NETDLL.dll" Name="NETDLL.dll" KeyPath="yes" Source="..\NETDLL.dll" /> 
    <Class Id="{78BE...}" Context="InprocServer32" Description="NETDLL" ThreadingModel="both" ForeignServer="mscoree.dll"> 
    <ProgId Id="NETDLL" Description="NETDLL" /> 
    </Class> 
    <RegistryValue Root="HKCR" Key="CLSID\{78BE...}\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" Value="" Type="string" Action="write" /> 
    <RegistryValue Root="HKCR" Key="CLSID\{78BE...}\InprocServer32\1.0.1.0" Name="Class" Value="NETDLL" Type="string" Action="write" /> 
    <RegistryValue Root="HKCR" Key="CLSID\{78BE...}\InprocServer32\1.0.1.0" Name="Assembly" Value="NETDLL, Version=1.0.1.0, Culture=neutral" Type="string" Action="write" /> 
    <RegistryValue Root="HKCR" Key="CLSID\{78BE...}\InprocServer32\1.0.1.0" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" /> 
    <RegistryValue Root="HKCR" Key="CLSID\{78BE...}\InprocServer32\1.0.1.0" Name="CodeBase" Value="file:///[#NETDLL.dll]" Type="string" Action="write" /> 
    <RegistryValue Root="HKCR" Key="CLSID\{78BE...}\InprocServer32" Name="Class" Value="NETDLL" Type="string" Action="write" /> 
    <RegistryValue Root="HKCR" Key="CLSID\{78BE...}\InprocServer32" Name="Assembly" Value="NETDLL, Version=1.0.1.0, Culture=neutral" Type="string" Action="write" /> 
    <RegistryValue Root="HKCR" Key="CLSID\{78BE...}\InprocServer32" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" /> 
    <RegistryValue Root="HKCR" Key="CLSID\{78BE...}\InprocServer32" Name="CodeBase" Value="file:///[#NETDLL.dll]" Type="string" Action="write" /> 
    <RegistryValue Root="HKCR" Key="Component Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" Name="0" Value=".NET Category" Type="string" Action="write" /> 
    <RegistryKey Root='HKLM' Key='Software\NETDLL'> 
    <RegistryValue Name='Description' Type='string' Value='NETDLL'/> 
    </RegistryKey> 
</Component> 

Come posso scrivere in HKCR \ CLSID, HKCR \ Wow6432Node \ CLSID, HKLM \ Software, e HKLM \ Software \ Wow6432Node tutto in una volta?

risposta

0

Provate le opzioni regasm.exe/x86 e/x64.

Sono disponibili anche versioni a 32 e 64 bit di regasm.exe, una su C:\windows\microsoft .net\<version>\Framework e un'altra su Framework64, vedere se ciò è utile.

+0

Scrivere CustomActions è un problema, e mi lascia in dubbio che funzionerà con la disinstallazione o il rollback. Sembra che avrei bisogno di eseguire 'reg.exe' anche per aggiungere valori a HKLM. –

+0

regasm.exe non supporta le opzioni della riga di comando/x86 o/x64. –

0

Installare due copie del file, una sotto ProgramFiles64Folder e ProgramFilesFolder. Spreca .5MiB, ma è semplice.

+0

Ciò richiede la compilazione dell'assembly .NET con AnyCPU? – tronda

0

sono riuscito registrare la stessa DLL su un sistema a 64 bit per x86 e 64bit giocando con due componenti, uno per il 64 bit e una per la registrazione x86:

<Component Id="NETDLL.dll" Directory="INSTALLDIR" Guid="*"> 
    <Class Id="{78BE...}" Context="InprocServer32" Description="NETDLL" 
     ThreadingModel="both" ForeignServer="mscoree.dll"> 
     <ProgId Id="NETDLL" Description="NETDLL" /> 
    </Class> 
    <File Id="NETDLL.dll" Name="NETDLL.dll" KeyPath="yes" 
      Source="..\NETDLL.dll" /> 
    <RegistryValue Root="HKCR" Key="CLSID\{78BE...}\Implemented Categories {62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" Value="" Type="string" Action="write" /> 
    ... 
</Component> 
<Component Id="NETDLLWin64.dll" Guid="{885F75B1-3046-42BD-8B37-F8FA0E8D7A51}" Win64="yes" Directory="INSTALLDIR"> 
    <Class Id="{78BE...}" Context="InprocServer32" Description="NETDLL" ThreadingModel="both" ForeignServer="mscoree.dll"> 
     <ProgId Id="NETDLL" Description="NETDLL" /> 
    </Class> 
    <RegistryValue Root="HKCR" Key="CLSID\{78BE...}\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" Value="" Type="string" Action="write" /> 
    ... 
</Component> 

ho aggiunto Guid - Attributi nel nodo Componente, modificato l'ID per il secondo componente e aggiunto Win64 = "sì" Attributo. Inoltre non duplicare il file. Spero che questo ti aiuti, se hai molte dipendenze e non duplichi i File.