好吧,我显然错过了一些东西。我正在尝试遵循这一点,以便安装到 GAC 并使其可用于开发。但是,唯一发生的事情是 DLL 被放入 ProductDirectory。它没有出现在 GAC 中,也没有添加注册表项。我怎样才能让它工作?
下面 Product.wxs 的相关部分。
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="Me.Common" Language="1033" Version="1.0.0.0" Manufacturer="Me" UpgradeCode="ea52947a-0980-435d-a8f5-280d3526cb90">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<!-- The feature to install. -->
<Feature Id="ProductFeature" Title="Me.Common" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="ProductDirectory" Name="Me.Common">
<Directory Id="GAC" Name="GAC" />
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents">
<Component Id="RunTime_Me.Common" Directory="GAC" Guid="E2B19C22-DC01-432D-85B0-0E4948F95A43">
<!-- Add to GAC. -->
<File Id="RunTime_Me.Common"
Source="$(var.Me.Common.TargetDir)$(var.Me.Common.TargetFileName)"
Assembly=".net"
KeyPath="yes" />
</Component>
<Component Id="DesignTime_Me.Common" Directory="ProductDirectory" Guid="C1BD8CD1-E834-49D5-B499-D9E313E70669">
<!-- Add locally. -->
<File Id="DesignTime_Me.Common"
Source="$(var.Me.Common.TargetDir)$(var.Me.Common.TargetFileName)"
KeyPath="yes" />
<!-- Add to registry so that Visual Studio can find it via Add Reference. -->
<Registry Id="Registry_DesignTime_Me.Common_AssemblyFolders"
Root="HKLM"
Key="SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\[ProductName]"
Value="[$DesignTime_Me.Common]"
Type="string" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
原来它已经安装在 GAC 中。我找错地方了;.NET 现在有第二个 GAC 用于 4.0 项目 (C:\Windows\Microsoft.NET\assembly)。这留下了注册表项。我收到了一条已弃用的警告Registry
,因此我用以下内容替换了该组件,但仍然无法正常工作:
<Component Id="DesignTime_Me.Common" Directory="ProductDirectory" Guid="C1BD8CD1-E834-49D5-B499-D9E313E70669">
<!-- Add locally. -->
<File Id="DesignTime_Me.Common"
Source="$(var.Me.Common.TargetDir)$(var.Me.Common.TargetFileName)"
KeyPath="yes" />
<!-- Add to registry so that Visual Studio can find it via Add Reference.
These require .NET v4.0 minimum. -->
<RegistryKey Root="HKLM"
Key="SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\[ProductName]">
<RegistryValue Type="string" Value="[$DesignTime_Me.Common]" />
</RegistryKey>
</Component>
</ComponentGroup>