Download and install the Web Deployment Projects plug-in.
: VS 2005 download Web Deployment Projects
This is an msi, 919 K, and installation is OK. Remember to shut down VS when installing it.
Create a Web Deployment project
Open the solution where the Web Project is located, right-click the Web Project, and select "Add Web Deployment Project... "
In the displayed dialog box, set the name of the Web Deployment Project (assuming Web_Deploy is set here) and click "OK". The Web Deployment Projects will automatically add a Deployment Project to the solution.
Configure a Web Deployment project
Right-click the Web_Deploy project and select "property page". You can set it as needed. If it is just a simple deployment, its default settings are OK.
Right-click the Web_Deploy Project and choose "Open Project File" to Open the deployment Project File. Here, you can add processing methods for events such as BeforeBuild, BeforeMerge, AfterMerge, and AfterBuild. For example:
Create a folder after generation:
<Target Name = "AfterBuild">
<MakeDir Directories = "$ (TargetDir) \ Upload"/>
</Target>
Exclude the test page from a folder
<ItemGroup>
<ExcludeFromBuild Include = "$ (SourceWebPhysicalPath) \ Test \ ** \ *. *"/>
</ItemGroup>
Right-click the Web_Deploy project and choose generate ". In the output window, we can see that the Generated Process calls aspnet_compiler.exe to compile the website.
Open the generated directory. The default directory is the Debug directory in the directory where the Web_Deploy project is located. The directory contains the. aspx file and. config file. The bin directory contains the compilation result, which does not contain the source code. The compiled dll file name does not have the suffix of each change.
Create a Web deployment project
Create a Web deployment project (assuming the name is Web. Setup ).
Add the file generated by the Web_Deploy project to the file system of the Web. Setup project.
Do some necessary settings for the Web. Setup project. Of course, I did the experiment, so I kept the default settings.
Generate a Web. Setup Project
Complete
Install msi. OK.
Note: Some configurations of the web deployment project are described as follows:
Right-click the properties page of The Web_deploy project and check "configuration properties". Check "Compilation" options first:
Output Folder in Compilation sets the project Output path, which can be the default value.
Check Generate debug information and Allow this precompiled site to be updatable.
Four options in Output Assemblies:
1. merge all outputs to a single assembly-all outputs are compiled into an assembly (parameter: assembly name) 1.1 Treat as library component (remove the App_Code.compiled file) -App_Code is treated as a class library (deleting the App_Code.compiled file)
2. Merge each individual folder output to its own assembly-a separate directory in the WEB project will be compiled into a set of Programs (parameter: assembly prefix)
3. Merge all pages and control outputs to a single assembly-all page controls are compiled into one assembly (parameter: assembly name)
4. create a separate assembly for each page and control output-Create an assembly Signing for each page and control using the key file to Create a strong namespace assembly Here we only need to set "1. merge all outputs to a single assembly-all outputs are compiled into an assembly (parameter: assembly name) "(I set Web_deploy) and "1.1 Treat as library component (remove the App_Code.compiled file)-App_Code is considered as a class library (delete the App_Code.compiled file)" (This check box is required ).
In this way, we can change the page inheritance relationship of the program to publish the website! For example:
Modify the PAGE of each ASPX file on the website as follows:
Index. aspx
<% @ Page Language = "C #" MasterpageFile = "~ /MasterPage. master "AutoEventWireup =" true "CodeFile =" Index. aspx. cs "Inherits =" wjj. Web. Index "Title =" Homepage "%>
Note that Inherits = "wjj. Web. Index" and wjj. Web are my own namespace.
Index. aspx. cs should also be added with a namespace
Namespace wjj. Web
{
Public partial class Index: System. Web. UI. Page
{
Protected void Page_Load (object sender, EventArgs e)
{
}
}
}
Now, right-click the project Web_deploy and click "re-create". The problem is finally solved!
The PAGE generated by Index. aspx is as follows:
<% @ Page language = "C #" masterpagefile = "~ /MasterPageDefault. master "autoeventwireup =" true"
Inherits = "wjj. Web. Index, Web_deploy" title = "Homepage" %>