c# - 创建骨架 WiX 扩展时失败

标签 c# dll wix

我刚开始使用 WiX,对 C#/.NET 的了解为零

现在我正在尝试通过引用此页面创建一个简单的 WiX 扩展:WiX3 - Simple Example of Extension .

这是该页面中描述的步骤:

  • 在 Visual Studio 中,创建一个名为 SampleWixExtension 的新 C# 库 (.dll) 项目。

  • 将对 wix.dll 的引用添加到您的项目。

  • 添加引用 Microsoft.Tools.WindowsInstallerXml 命名空间的 using 语句。

    使用 Microsoft.Tools.WindowsInstallerXml;

  • 让您的 SampleWixExtension 类继承自 WixExtension。

    公共(public)类 SampleWixExtension : WixExtension {}

  • 将 AssemblyDefaultWixExtensionAttribute 添加到您的 AssemblyInfo.cs。

    [程序集:AssemblyDefaultWixExtension(typeof(SampleWixExtension.SampleWixExtension))]

  • 构建项目。

但是,当我完成这些步骤并构建这个项目时,我遇到了以下错误:

    ------ Build started: Project: SampleWixExtension, Configuration: Debug Any CPU ------
    D:\working\test\SampleWixExtension\SampleWixExtension\Properties\AssemblyInfo.cs(37,12): error CS0246: The type or namespace name 'AssemblyDefaultWixExtension' could not be found (are you missing a using directive or an assembly reference?)
    D:\working\test\SampleWixExtension\SampleWixExtension\Properties\AssemblyInfo.cs(37,12): error CS0246: The type or namespace name 'AssemblyDefaultWixExtensionAttribute' could not be found (are you missing a using directive or an assembly reference?)

    Compile complete -- 2 errors, 0 warnings

有人知道为什么以及如何解决它吗?

顺便说一句,在解决方案资源管理器中,我可以看到 wix 已经在 References 中,其属性的路径为 C:\Program Files (x86)\Windows Installer XML v3.5\bin\wix.dll

最佳答案

通过添加

using Microsoft.Tools.WindowsInstallerXml;

进入AssemblyInfo.cs,项目现已成功构建。

关于c# - 创建骨架 WiX 扩展时失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11930367/

相关文章:

c# - EntityFramework Code First 甲骨文

c# - 如何使用 ImageFormatConverter.ConvertFromString 将包含 HTML 响应的字符串转换为图像?

c++ - 如何在 DLL 之间共享类

c# - Windows 10 移动应用程序中带有黑色字体的黑色状态栏

c# - WPF-MVVM多项目结构

c++ - 没有 libeay32.dll 的 OpenSSL win32

c# - 从外部事件调用时 Unity SceneManager.LoadScene() 不起作用

wix - 如何在用户取消时保留应用程序的先前版本 - Wix 安装程序升级

c# - WiX - 如何使用配置文件来决定运行哪个 MSI?

wix - 用于在失败的RegistrySearch未运行后设置属性的自定义操作