vs2005,vs2008,vs2010 compiling the ASP. NET Web site into a DLL file

Source: Internet
Author: User

Category: C#/asp.net 2012-10-09 22:19 1342 People read Comments (1) favorite reports dllasp.net2010deploymentwebsiteassembly

vs when publishing a Web site, all CS generated DLL files in the bin directory are randomly named each time, such as: App_web_xxxxxxxx.dll (xxxxxxx is 8 lowercase letters and numbers of strings, random), so it is inconvenient to update the Live site, Because the dynamic library name has changed, it involves each ASPX file changing the reference declaration on the library every time:
<%@ page language= "C #" autoeventwireup= "true" inherits= "_default, APP_WEB_S9NOR8MV"%>
Even if there is a small change in CS, because the generated dynamic library name is different, all ASPX files will have to be re-transmitted again. If you can fix the file name of the dynamic library, update the site is much more convenient, only changed CS, rebuild the DLL file, just need to replace this DLL file.

===========================================================

Under VS2005 Environment:
Web Deployment Projects with Visual Studio 2005:
One: (Size: 905K)
Http://download.microsoft.com/download/c/c/b/ccb4877f-55f7-4478-8f16-e41886607a0e/WebDeploymentSetup.msi
Two: (Size: 919K)
Http://download.microsoft.com/download/9/4/9/9496adc4-574e-4043-bb70-bc841e27f13c/WebDeploymentSetup.msi
When you give a link to the compiled file, if the ASPX contains Chinese characters, the page will most likely show as garbled, so please note the version issue with the Downloader.
The simple operation is as follows:
1. After downloading, install directly, after installation, open VS2005;
2. Under [Generate]->[Publishing site] There will be an extra item [Add Web Deployment Project], or you can right-click on the Web site project you want to publish. Directly select [Add Web Deployment Project], and when the Properties dialog box pops up, After setting the specified name and adding the directory, you can see that there is one more item in the current solution, there are many other properties that can be set by yourself;
3. When you right-click->[build in the scenario you just added, the appropriate files and directories are generated.

===========================================================

Under VS2008 Environment:
Method 1: In the "Publish Web site" option, tick "use fixed-named and single-page assemblies", each page corresponding to a DLL, and the DLL file name is fixed (although the name looks very casual), as long as the ASPX file name does not change. This generates a large number of DLL files, which are not yet visible in the actual application.

Method 2: Place all CS files in the App_Code directory so that all CS are generated in the App_Code.dll dynamic library each time. This time, the first line of the ASPX file is changed after the new command is created:
<%@ page language= "C #" autoeventwireup= "true" inherits= "_default"%>
Or:
<%@ page language= "C #" autoeventwireup= "true" inherits= "_default, App_Code"%>
When this is released, a small change to CS can only be replaced by a App_Code.dll file. When you do not use the CodeFile property, VS has no reason to modify your aspx file header.

Method 3: In fact, very similar to the previous one, if you feel that the ASPX corresponding to the CS file in the App_Code directory is a bit abrupt, then for the current solution to add a Class Library project, such as ClassLibrary1, the ASPX CS file is placed here Project, the corresponding ASPX file directive is:
<%@ page language= "C #" autoeventwireup= "true" inherits= "_default"%>
Or:
<%@ page language= "C #" autoeventwireup= "true" inherits= "_default, ClassLibrary1"%>
Small changes can be replaced with ClassLibrary1.dll, and in the same way when you do not use the CodeFile property, VS has no reason to modify your aspx file header. Only the CS file is placed on the server, and the CodeFile instruction is used when the program is compiled by ASP.

Method 4:web Deployment Projects with Visual Studio 2008:
Http://download.microsoft.com/download/0/5/b/05b4424b-5b9b-4961-8ec6-91e9f1741b2d/WebDeploymentSetup.msi ( Size: 686K)
Http://download.microsoft.com/download/0/5/b/05b4424b-5b9b-4961-8ec6-91e9f1741b2d/WebDeploymentSetup.msi
The simple operation is as follows:
1) after download, install directly, after installation, open VS2008;
2) There will be an extra item [Add Web Deployment Project] under [Generate]->[Publishing site], or you can right-click on the Web site project you want to publish. Directly select [Add Web Deployment Project] After the pop-up Properties dialog box. Set the specified name (such as Website1_deploy) and the storage directory (c:\target), add, you can see the current solution more than one (Website1_deploy), Website1_deploy There are many other properties can be set, One of the important default options is:
Merge all outputs to a single assembly
Assembly name: Is Website1_deploy.
3) Right-click->[build in the scenario you just added, or build Website1_deploy to generate a directory of the published files in the directory specified previously (c:\target). Go to the C:\target directory, and you'll see that all CS files in your Web project, including ASPX-related and CSS files in App_Code, are compiled into the Website1_deploy.dll file. The header of the ASPX file is:
<%@ page language= "C #" autoeventwireup= "true" inherits= "Default, Website1_deploy"%>
As long as the Website1_deploy.dll file name is fixed, the declaration portion of ASPX is always the same, so each time just to modify the CS file, just change a website1_deploy.dll file.

Compared to the second to third method, only one setup, no need to move the code file for each ASPX file, but also to change the declaration portion of the ASPX file, and for the Web Site can also build DEBUG version, so this should be the ultimate.

===========================================================

Under VS2010 Environment:

1.Visual studio®2010 Web Deployment Projects:
http://www.microsoft.com/downloads/details.aspx?FamilyID=89f2c4f5-5d3a-49b6-bcad-f776c6edfa63&displaylang=en

2 Install the Visual studio®2010 Web Deployment projects plug-in and then right-click on the Web site project to see an Add Web Deployment project

3 Click Add Web Deployment Project and the following dialog box pops up

4 name and path can be modified, the general default is good, click OK, in the solution will generate a deployment project

5 Right-click on the deployment project and click "Generate"

6 After the build succeeds, a release directory will be generated in the directory where the project is deployed, and all files published by the project are in the release directory, and in the bin directory you can see that there are many irregularly named DLLs. The name of the generated DLL is the same as the name that was filled in when you added the deployment project earlier, Eduappweb_deploy

This article transferred from: http://www.cnblogs.com/suzh/archive/2011/04/26/2029564.html

vs2005,vs2008,vs2010 compiling the ASP. NET Web site into a DLL file

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.