【问题标题】:Visual Studio Installer Project: Custom Action -> entry point not foundVisual Studio 安装程序项目:自定义操作 -> 找不到入口点
【发布时间】:2015-09-05 04:24:33
【问题描述】:

我尝试向安装程序项目添加自定义操作。我使用以下代码添加了一个自定义操作项目:

  public class CustomActions
  {
    [CustomAction]
    public static ActionResult CustomAction1(Session session)
    {
      session.Log("Begin CustomAction1");

      return ActionResult.Success;
    }
  }

在我的安装程序项目中,我添加了对 CustomAction_project 的引用,并将以下条目添加到自定义操作 -> 安装:

名称:CustomAction 的主要输出(活动) 入口点:CustomAction1 安装程序类:假 SourcePath:CustomAction.dll 的路径

现在,如果我尝试构建我的安装程序项目,我会收到以下错误:

错误:在模块中找不到入口点“CustomAction1” 'PATH\CustomAction.dll' 用于自定义操作'主要输出来自 CustomAction (Active)'。

  • 我做错了什么?自定义操作代码由 Visual Studio 2013 自动生成!

【问题讨论】:

    标签: c# windows windows-installer installation custom-action


    【解决方案1】:

    您已经构建了一个用于 WiX 设置的托管代码自定义操作项目。如果您使用的是本机 Visual Studio 安装程序项目,则需要安装程序类自定义操作。这些可能会有所帮助:

    https://msdn.microsoft.com/en-us/library/vstudio/d9k65z2d(v=vs.100).aspx

    http://www.c-sharpcorner.com/uploadfile/ddoedens/usinginstallerclassestoeasedeploymentinvs.net12012005061649am/usinginstallerclassestoeasedeploymentinvs.net.aspx

    http://vbcity.com/forums/t/145818.aspx

    基本上,您将安装程序类添加到您的项目中,并覆盖 install 方法。

    【讨论】:

      【解决方案2】:

      如果您想使用 Microsoft.Deployment.WindowsInstaller 中的 CustomActions(而不是 Installer 类) 你需要:

      1. here 安装 wix 工具集。
      2. 在VS中新建一个类Project
      3. 引用 %WiX%SDK\Microsoft.Deployment.WindowsInstaller.dll
      4. 创建一个类似this的类。
      5. 编译。
      6. 编译的结果应该是一个projectName.dll和projectName.CA.dll,projectName.CA.dll必须包含在你的安装项目中,如下所示:

      安装愉快... :)

      【讨论】:

        猜你喜欢
        • 2011-09-06
        • 2023-03-29
        • 1970-01-01
        • 2012-01-26
        • 2021-11-22
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多