Original: Using advanced Installer to package ASP.NETMVC together with the IIS service and MySQL database as an EXE installation package
Because of business needs, The project needs to package the ASP.NETMVC project into an EXE installer to the customer, so that the customer can directly point to the next step to install the deployment Web program, and also to install the IIS service and MySQL together to the server, because the customer's computer may be 64-bit or 32-bit, so in the packaging of the time need to package into two security Packaging. The study took a few days to finally get something, and the bottom is the packing step.
Packaging steps:
First, pre-preparation
1. Publish the ASP.NETMVC to a local directory
2, the database preparation, the preparation of two free installation of MySQL database, respectively, 64-bit and 32-bit. Set the account password in two versions of the database system, respectively, and ASP.NETMVC in the corresponding configuration, in two versions of the database to create a new ASP.NETMVC database and table, as well as the initial data, of course, you can not build the database table and initialization data in advance, you can set the database password at the time of installation, the initialization of the database is also OK, but it is easy to try many times Error, so choose to initialize the database in advance, and then direct packaging method, so that the production is more simple and convenient, not error-prone, after the new completed in the database directory will have a corresponding file.
Create a new Bat batch program in MySQL database to install MySQL service
The contents of the batch Start_mysql.bat are:
echo off
Set Path=%~dp0
echo Install MySQL service ...
CD%path%\bin\
Mysqld.exe--install MySQL
echo Start MySQL Service
"%SystemRoot%" \system32\net start MySQL
In batch processing, the reason for the CD to the bin directory before executing EXE, instead of directly using the EXE absolute path to execute, because the user may install the program into a directory with spaces such as D:\Program Files (x86)
In this case, if the absolute path of Mysqld.exe is executed, the batch will error, causing the installation to fail.
Now that the package preparation is complete, here are the steps to pack
Second, packaging
1. Create a packaged project
Click Next
Choose. NET run version, you can use the default network download, or in advance download good. NET run environment and then a piece to package to the installation package, select the default URL to download, install the program when the installation package will be smaller, but need computer networking to install, if you choose to download in advance, in this piece to package into the installation package, the installation Large, installation time does not need the network can also be installed, depending on the individual situation to choose
I choose to download the good. NET installation package in advance
Next
Next
2. Configure the Package project permissions
4. Add MySQL version of the free installation program
5. Set up Windows Apps
6, add IIS to the packaging project, the installation of the program can be packaged with IIS, IIS installer is a bat batch program, online can download
7. Add MySQL installation events, install the application and install MySQL into the system
Select the File selection box, select the MySQL installation bat file that you prepared before
At this point a simple installation package is completed, click Buld Release to build the installation package
Use advanced Installer to package ASP.NETMVC together with the IIS service and MySQL database as an EXE installation package