Visual Studio Installer项目:自定义操作 - >未找到入口点

时间:2015-06-19 08:49:19

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

我尝试向安装程序项目添加自定义操作。我添加了一个自定义操作项目,其中包含以下代码:

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

      return ActionResult.Success;
    }
  }

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

名称:CustomAction的主要输出(活动) EntryPoint:CustomAction1 InstallerClass:错误 SourcePath:CustomAction.dll的路径

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

  

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

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

2 个答案:

答案 0 :(得分: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方法。

答案 1 :(得分:0)

如果要使用Microsoft.Deployment.WindowsInstaller中的CustomActions(不是安装程序类) 你需要:

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

    快乐安装......:)