给Windows Installer添加Custom Action
时间:2010-10-08 来源:lbsx
Windows Installer的Custom Action可以是exe, dll, vbs或js文件。
通过这个Custom Action,只要有足够的权限,基本上想做什么就做什么。
用C++编写Custom Action的例子(省略建各种工程的步骤):
1.C++代码。其中可以通过MsiDoAction调用一些别的Action。目前并没有了解。
2 #include <Msiquery.h>
3 #include <stdio.h>
4 #pragma comment(lib, "msi.lib")
5
6 int main(int argc, char *argv[])
7 {
8 printf("This is a custom action");
9 getchar();
10 //MsiDoAction();
11 return ERROR_SUCCESS;
12 }
13
2.在布置项目的File System View中新建一个文件夹,并将此exe添加到该文件夹中。
3.在Custom Actions View中添加Custom Action,选择该exe。
也可以将这多个项目集中到一个解决方案中,通过添加项目的Primary Output来进行添加。
参考:
Visual Studio Setup - projects and custom actions
相关阅读 更多 +