The day before yesterday, I wrote an article about using InfoPath's installable template to deploy InfoPath. The installable template is really good, but it has a problem because it is a separate msi file, if I want this template to be only part of the program I want to install, I still need to deploy other things with another Installer. This seems redundant, so I made some analysis on the msi automatically generated by InfoPath.
During the running process, I found that every time it runs a console window, I began to wonder if a command line program was called and tracked with ProcessExplorer, it is found that there is a ca <TemplateName> In the target installation directory. when the exe program is running, open the directory to find that it is hidden, but don't worry, the installer will not delete it after the installation is complete (because it will be used when it is uninstalled ). If you double-click to run the program, a prompt window is displayed, which is used to register and uninstall the template.
From the pop-up information, we know that to install an InfoPath form template, we can use the following command RegTemplate formtemplatefile/install
The command to uninstall is RegTemplate formtemplatefile/uninstall.
For example, if we have an abc. xsn template, the installation command is RegForm abc. xsn/install. Note that the formtemplatefile must be the complete path. The path is not included only when the template is located in the current directory.
Therefore, the console window we see is that it is installing or uninstalling the template. In this way, we can use the custom action in the VS installation project to implement it.
First, you need to register the InfoPath template file (. xsn) in the installer.
Then, we create an installauto-defined role and select regform.exe as the command to execute this action. The parameters for setting this action are as follows:
Name: install template
Arguments: filetemplatefile/Install (If your template file is stored in the application root directory, the filetemplatefile here can be left with no path .)
Then, create an uninstallauto-defined role and select regform.exe as the command to be executed for this action. The parameters are as follows:
Name: Uninstall template
Arguments: filetemplatefile/Uninstall
Now, your installer will automatically register and uninstall the template file.
Note: RegTemplate and RegForm are two different tools. I made a mistake before, so I 'd like to clarify to you!