Vs instructions on how to generate a fixed-name DLL file webdeploymentsetup during website publishing

Source: Internet
Author: User
Vs2008 in the release of the site, bin directory for all Cs generated DLL files are named randomly each time, like this App_Web_g2dnx-qj.dll, app_web_s9nor8mv.dll, so it is very inconvenient to update the live site, because the dynamic library name has changed, every aspx file has changed its reference statement for the library every time:

<% @ Page Language = "C #" autoeventwireup = "true" inherits = "_ default, app_web_s9nor8mv" %>

Even if there is a small change to CS, because the generated dynamic library name is different, all aspx files must be re-transmitted. If the file name of the dynamic library can be fixed, it will be much easier to update the website. If you only change the CS file, re-generate the DLL file and replace the DLL file. We can find several methods:

1. In the "Publish Website" option, select "use fixed name and single page ".ProgramSet ", a DLL corresponding to each page, and the DLL file name is fixed (although the name looks casual), as long as the aspx file name remains unchanged. This will generate a large number of DLL files, which are not available in actual applications.

2. Put all Cs files in the app_code directory so that all Cs files are generated to the app_code.dll dynamic library every time. At this time, the first line of the aspx FILE command should be changed:

<% @ Page Language = "C #" autoeventwireup = "true" inherits = "_ default" %>

Or:

<% @ Page Language = "C #" autoeventwireup = "true" inherits = "_ default, app_code" %>

In this case, you only need to replace an app_code.dll file with a small change to CS. When the codefile attribute is not used, VS has no reason to modify your Aspx file header.

3. the third method is actually very similar to the previous one. If you think it is a little abrupt to put the CS file corresponding to aspx in the app_code directory, add a new class library project for the current solution, such as classlibrary1, put all aspx CS files in this project. The corresponding aspx file commands are:

<% @ Page Language = "C #" autoeventwireup = "true" inherits = "_ default" %>

Or:

<% @ Page Language = "C #" autoeventwireup = "true" inherits = "_ default, classlibrary1" %>

Replace classlibrary1.dll with a small change. Similarly, when you do not use the codefile attribute, VS has no reason to modify your Aspx file header. Only the CS files must be stored on the server. When ASP. NET is used to compile the program, the codefile command takes effect.

4. Web deployment projects with Visual Studio 2008:
Http://download.microsoft.com/download/0/5/ B /05b4424b-5b9b-4961-8ec6-91e9f1741b2d/WebDeploymentSetup.msiThe Installation File is very small, 686 KB.

The procedure is as follows:

1) download and install it directly. After installation, open vs2008;

2) under [generate]-> [Publish website], an [add web deployment project] will be added. You can also right-click the project on the website to be released. select [add web deployment project]. After the attribute dialog box is displayed. set the specified name (such as websiteappsdeploy) and storage directory (C: \ target, 
We can see that the current solution has one more item (websiteincludeploy). websiteincludeploy has many other attributes that can be set. Among them, there is an important default option:

Merge all outputs to a single assembly

Assembly name: websiteappsdeploy.

3) Right-click the newly added solution-> [generate], or build websiteappsdeploy will be in the previously specified directory (C: \ target) generate the directory of the files that can be released. Go to the C: \ target directory, and you will find all the CS files in your web project, including the CSS files associated with aspx and app_code, which are compiled into the websiteappsdeploy.dll file. The header of the aspx file is:

<% @ Page Language = "C #" autoeventwireup = "true" inherits = "default, websiteappsdeploy" %>

As long as the file name of websiteappsdeploy.dll is fixed, the aspx declaration is always the same, so every time you modify the CS file, you only need to change the websiteappsdeploy.dll file.

Compared to the second and third methods, you only need to set one time, and you do not need to create An ASPX file pair for eachCodeFile, you have to modify the Declaration Part Of The aspx file, and the debug version can also be built for the web site, so this should be the ultimate.

Reference: 1. How do I set a fixed DLL file name when vs2008 is released and a website is generated?
2. How to Use vs2005 to solve the problem of inconvenient website publishing

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.