Use VS2005 to make installation packages.
1. Select "Other Project Types"-> the "Setup and Deployment" node in the left tree of the New Project dialog box and select Web Setup Project on the right.
2. Right-click on solution in Solution Explorer, select "Add"-> "Existing Web Site" To add the folder of the compiled Web website to solution.
If you add a site that is compiled using Aspnet_compiler, you may have the following prompt box and click "Yes" to do so.
3. Add a new "Class Library", the name "Createdb", to create the operation of the database.
Delete the default generated "Class1.cs", on this item right click, select "Add"-> "New Item", in the pop-up dialog box select "Installer Class", click OK.
Add the following code to the class:
private void ExecuteSQL (String connectionString, String databaseName, String sql)
{
SqlConnection SqlConnection = new SqlConnection (connectionString);
SqlCommand SqlCommand = new SqlCommand (sql, SqlConnection);
Try
{
SqlCommand.Connection.Open ();
SqlCommand.Connection.ChangeDatabase (DatabaseName);
SqlCommand.ExecuteNonQuery ();
}
catch (Exception Exception)
{
Throw exception;
}
Finally
{
SqlCommand.Connection.Close ();
}
}
foreach (XmlNode XmlNode in xmldoc["Configuration"] ["connectionstrings"]. ChildNodes)
{
if (Xmlnode.name = = "Add")
{
if (xmlnode.attributes["name"). Value = = "DbConnection")
{
xmlnode.attributes["ConnectionString"]. Value = String.Format ("Data source={0};initial catalog={1}; Persist Security info=true; User Id=printeryerp; Password=printeryerp ",
server, database);
}
if (xmlnode.attributes["name"). Value = = "Usermanageservicesconnection")
{
xmlnode.attributes["ConnectionString"]. Value = String.Format ("Data source={0};initial catalog={1}; Persist Security info=true; User Id=printeryerp; Password=printeryerp ",
server, database);
}
}
}
Xmldoc.save (ConfigFile);
}
catch (Exception Exception)
{
Throw exception;
}
}
4. Right-click on the Web Setup Project project, select "Add"-> "Project Output", select Project "Createdb", select "Primary Output", and click OK. Repeat the above action, will select the Web Site just added, select "Content Files", click OK.
5. Right-click on the Web Setup Project project and select "Add"-> "File" to add script Createdb.sql to create database tables, stored procedures, and views. Repeat, the script insertdata.sql to add the underlying data to the datasheet is added. Repeat, add the program Osql.exe.
6. Right-click on the Web Setup Project project, select "Add"-> "Merge Module", select "Vc_user_crt71_rtl_x86_---. MSM" In the pop-up dialog box, and press OK. The VC runtime was added because it was found on a clean machine when the Osql.exe program needed this library.
7. Right-click on the WEB Setup Project project, select Properties, and in the dialog box that pops up, you can set some of the installer's attributes. Click on the button "Prerequisites", select ". NET Framework 2.0" and "Windows Installer 3.1" In the pop-up dialog box, check the Download prerequisites from the same Location as my application ". This allows the components and applications to be packaged together and automatically detected and installed when they are installed. If you need to deploy a computer that is not "Windows Installer 3.1" Without the latest patches, ". NET Framework 2.0" cannot be installed without this component.
8. Right-click on the Web Setup Project project, select "View"-> "Custom Actions", click on the node "Install" in the tree graph, and select "Add Custom Actions". Select "Web application Folders" In the pop-up dialog box, select "Primary output from Createdb (Active)" below and click OK.
9. Right-click on the Web Setup Project project, select "View"-> "User Interface", right-click on the child node "Start" of the Node "Install" that appears, and select "Add Dialog", In the pop-up dialog box, select Textboxes (A).
Right-click on the newly added node "textboxes (A)" and select "Properites window" to set the Edit*property property to "CUSTOMTEXTA1", "CUSTOMTEXTA2", and " CUSTOMTEXTA3 "and" CUSTOMTEXTA4 ".
10. Right-click on the Primary output from Createdb (Active) node that you just established, select Properties window, and set the CustomActionData property to/dbname=[ CUSTOMTEXTA1]/server=[customtexta2]/user=[customtexta3]/pwd=[customtexta4]/targetdir= "[targetdir]/".
Next, the entire solution is compiled, and two folders and two files are generated in the output directory.
The. NET Framework 2.0 and Windows Installer3.1 installation packages are included in two folders. The other two files were (project name). msi and Setup.exe. If you want to install, perform setup.exe.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.