Wix - 将程序集动态注册到 GAC

发布于 2024-07-29 10:26:28 字数 1397 浏览 1 评论 0原文

我正在编写一个 Wix 安装程序来将 .NET 程序集安装到 GAC。 简单...

我的问题是:是否有可能在未来证明这种情况,以便我可以提取在现有网络文件夹中找到的任何程序集并注册它们中的每一个 - 而不必对确切的程序集名称进行硬编码? 这将使我能够创建一个可以在将来反复重复使用的 MSI。

现在我的代码指向一个单独的 DLL,如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="16c27e1f-8f59-40bc-9ce6-ba816eae4323" Name="GACInstaller" Language="1033" Version="1.0.0.0" Manufacturer="GACInstaller" UpgradeCode="7fb35788-63aa-4cb1-9ad2-fd965cdeb7c8">
    <Package InstallerVersion="200" Compressed="yes" />

        <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />

        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLLOCATION" Name="GACInstaller">
                    <Component Id="ProductComponent" Guid="ae2bb9bd-f8d6-4060-b25b-8147fac155d6"> 
            <File Id='my_assembly' Name='my_assembly.dll' KeyPath='yes' Assembly='.net' Source='C:\my_assembly.dll' /> 
                    </Component> 
                </Directory>
            </Directory>
        </Directory>

        <Feature Id="ProductFeature" Title="GACInstaller" Level="1">
            <ComponentRef Id="ProductComponent" /> 
    </Feature>
    </Product>
</Wix>

I am writing a Wix installer to install .NET assemblies to the GAC. Easy...

My question is: is it possible to future proof this scenario so that I can pull ANY assemblies found in an existing network folder and register each of them - without having to hardcode the exact assembly names? This would allow me to create a single MSI that could be reused over and over again in the future.

Right now my code points to an individual DLL and looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="16c27e1f-8f59-40bc-9ce6-ba816eae4323" Name="GACInstaller" Language="1033" Version="1.0.0.0" Manufacturer="GACInstaller" UpgradeCode="7fb35788-63aa-4cb1-9ad2-fd965cdeb7c8">
    <Package InstallerVersion="200" Compressed="yes" />

        <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />

        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLLOCATION" Name="GACInstaller">
                    <Component Id="ProductComponent" Guid="ae2bb9bd-f8d6-4060-b25b-8147fac155d6"> 
            <File Id='my_assembly' Name='my_assembly.dll' KeyPath='yes' Assembly='.net' Source='C:\my_assembly.dll' /> 
                    </Component> 
                </Directory>
            </Directory>
        </Directory>

        <Feature Id="ProductFeature" Title="GACInstaller" Level="1">
            <ComponentRef Id="ProductComponent" /> 
    </Feature>
    </Product>
</Wix>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

南巷近海 2024-08-05 10:26:28

不,不是真的。 MSI 中需要更新的不仅仅是文件。 例如,每次安装的产品代码 (Product/@Id) 都必须是唯一的。 文件表信息全部需要更新。 我确信还有其他事情我忘记了,因为 WiX 工具集已经处理了这一切。

No, not really. More than just the file must be updated in the MSI. For example, the ProductCode (Product/@Id) needs to be unique for each individual install. The File table information all needs to be updated. I'm sure there are other things I'm forgetting since the WiX toolset takes care of it all.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文