Making the installation package for web applications with vs.net2003

xiaoxiao2021-03-06  20

It is very convenient to make a installer using vs.net2003, making it only to make a Web application installer. Simply simple steps can be completed.

First, create a installation and deployment project. The steps are as follows: 1. Add a new project in the solution in the Solution Explorer. Right-click the solution, select Add "-> New Project" in the pop-up menu. Select Install and Deploy Projects in the open dialog box and select the "Web Install Project" template. After entering the project name, click the "OK" button to add a new project to the solution. 2. Add the output of the project to the installation and deployment project. After adding the installation and deployment project, the VS.NET2003 IDE automatically opens a manager named "File System". Right-click the "Web Application Folder" in the right tree structure in this manager, select Add "-> Project Output in the pop-up menu. In the pop-up dialog box, select "Project" (at this time, it is your web application project), then select "Main Output" and "Content File" in the following list (which can be checked), Then select "Release .NET" in Configuration, click the "OK" button.

After two steps above, a basic installation and deployment procedure is completed, and after compiling this item, you get a web installer package.

However, in a lot of cases, we do the Web application to use the database, can you install the database while installed? The answer is yes. What should I do? Mr. Li Honggen has been solved. For details, please refer to the article below http://blog.9cbs.net/lihonggen0/Archive/2004/05/17/13654. The article in this article in Mr. Li Honggen's detailed introduction The production of the installer and how to install the database at the same time. The following is rical as follows: 1. Create a class library project, delete automatically generated class.cs, re-add a new item. Right-click this project, select "Add" -> Add New Item in the pop-up menu, select Installer Class in the pop-up dialog box. 2. Create a custom installation dialog. Right click on the installation and deployment items in the Solution Explorer, select View "->" User Interface "in the pop-up menu. In the Open "User Interface" manager, right-click "Start", select Add Dialog in the pop-up menu. Select "Text Box (a)" in the open dialog. Select "Text Box (a)", in the property, set up the Property property as CustomText1, CustomText2, Customtext3, CustomText4.3 in turn. Create a custom action. Right click on the installation and deployment items in the Solution Explorer, select View "-> Custom Action in the pop-up menu. In the Open "Custom Action" manager, right-click "Install" and select Add Custom Action in the pop-up menu. In the open dialog box, select "Web Application Folders" in "Find", select "The main output from Install1 (activity) in the list below (Install1 is the project name where" Installer "is. There is no method in the list, which can be added with the "output output to the installation and deployment item" above "). Then select the original added in the Custom Action Manager, set the CustomActionData attribute / dbName = [CustomText1] / Server = [CustomText3] / PWD == [CustomText4] / PWD == [CustomText4] / Targetdir = "[Targetdir] /" Note: Each setup content is / separated, and separated by space.

4. Rewrite the install method in this class and add the following code string strconn = string.format ("data source = {0}; user ID = {1}; password = {2};", this.context.Parameters [ "Server"], this.context.Parameters ["User"], this.context.Parameters ["PWD"]); this.executesql (StrConn, "Master", "Create Database" this.context.Parameters [" DBNAME "]); system.diagnostics.process psql = new system.diagnostics.process (); psql.startinfo.filename =" osql.exe "; psql.startinfo.arguments = string.format (" -u {0} P {1} -d {2} -i {3} db.sql ", this.context.Parameters [" User "], this.context.Parameters [" PWD "], this.context.Parameters [" dbname " ], this.context.Parameters ["Targetdir"]); psql.startinfo.windowstyle = system.diagnostics.processWindowStyle.hidden; psql.start (); psql.WaitForexit (); psql.close (); this, compile The installer can be installed together with the database.

The problem of installing the database is solved, there is a problem, that is to make the ASP.NET program running, an important condition is that the target computer must have a .NET framework, can also be a .NET framework together when the installer is installed. Installed? The answer is still sure. Specifically you can see http://www.microsoft.com/china/msdn/library/netframework/netframework/nfdnnetDepvsredistDeploy1_1.mspx mentioned several different ways to re-distribute .NET framework, the simplest one It should be used to use vs.net2003. The rough steps are as follows: 1. Install the VS.NET framework boot program plugin. This plugin can download from Microsoft's website, download address as follows: http://www.microsoft.com/downloads/details.aspx? FamilyId = 627921A0-D9E7-43D6-A293-72F9C370BD19 & DisplayLang = EN2. In the Solution Explorer, right-click the installation and deployment project, select View "->" Start Condition "in the pop-up menu, open the Start Condition Manager. 3. In the "Start Condition" manager, right-click on the "Target Computer", select Add Registry Start Condition in the pop-up menu. You will find that there is a "search registryntry1" in the "Search Target Computer", and "Condition1" in "Startup Condition". 4. Select "Search RegistryEntry1", fill in the "Properties" dialog box the following: Property: MDACSEARCHRegKey: Software / Microsoft / DataAccessRoot: vsdrrHKLMValue: FullInstallVer select "Condition1", fill out the following in the "Properties" dialog box: Condition: MDACSEARCH> = "2.6" That is because MDAC is required when installing the .NET framework. OK, now compiling and install and deploy projects, you get a installer that can be installed .NET framework.

转载请注明原文地址:https://www.9cbs.com/read-42699.html

New Post(0)