. Net website project DLL reference, Project Reference Management Issues

Source: Internet
Author: User
Tags tmp file

Generally, larger programs

To enhance the reusability of the program, multiple logically independent modules are managed as a separate project.

 

To facilitate project management, you can generate DLL files for projects and then reference them.

 

1. Source Code Security Management

2. Program independence is better

3. Release DLL files separately

 

However, when a program grows, it will find that there are more and more independent projects and DLL references become a big problem.

You know that you only need to select one DLL reference to add a class library project. Next time, you can automatically find the DLL file with the same name in the reference directory.

Therefore, you do not need to manage the DLL reference after adding a class library project. The project will automatically update the reference based on the DLL file changes!

(Note: The Path for generating the class library should be written as Z:/bin/dllname. DLL. The above must contain a drive letter. Otherwise, after the source code is embedded, it will be changed to a relative path after others get it. This is not the case! The drive letter must be written. It is best to generate the path and source code instead of putting it in one drive)

Add references to the Z:/bin folder!

 

 

But the DLL reference of the website project is different.

All DLL files must be placed in the bin folder!

Suppose I have a website project, which is divided into many sub-websites.

In this case, a bin folder needs to be created for each sub-website. If the source code has been modified and the DLL is regenerated

In this way, a new DLL file needs to be copied in each bin folder!

If a website is okay, if there are more than one, it will be over! Change the code once. Copy the code again under each website. Every time you find the DLL, it will be exhausted! What kind of work do you want to talk about?

So I have been thinking about this for a long time. I have come up with two solutions,

The first is to create a file replication tool. Monitoring file changes will automatically copy the changed DLL to each bin folder.

Things have indeed been made! The effect is acceptable! But copying is a little slow! The *. tmp file will also be copied!

Another solution is simpler and easier!

Is to use Symbolic Links

Maybe many people do not know what a symbolic link is.

The specific idea is to map the bin folder under each website to the Z:/bin directory.

In this way, you only need to modify the DLL files in the Z:/bin folder and the binfiles in other websites will be changed automatically, because it is actually the same folder.

A tool named junction.exe is used to establish a symbolic chain.

In order to facilitate management, you do not need to re-establish the symbolic link each time.

Go to http://download.csdn.net/source/2600862to download

The Code is as follows:

Junction "E:/projects/GM/gmsaasban/View/DCS/bin" "D:/wmb_bin"
Junction "E:/projects/GM/gmsaasban/View/CRM/bin" "D:/wmb_bin"
Junction "E:/projects/GM/gmsaasban/View/DMS/bin" "D:/wmb_bin"
Junction "E:/projects/GM/gmsaasban/View/ERP/bin" "D:/wmb_bin"
Junction "E:/projects/GM/gmsaasban/View/FMS/bin" "D:/wmb_bin"

 

In this way, you only need to replace the directory to automatically set the symbolic link.

Note:

1. When the source path in front of E:/projects/GM/gmsaasban/View/DCS/bin is mapped to the target path D:/wmb_bin

The bin directory of each website must be empty; otherwise, symbolic links may fail to be created. Some may fail even if they are empty,

2. The ing physical path cannot contain Chinese characters! Otherwise, the creation will fail.

3. If it still fails to be created, delete the Directory and re-create a bin directory and then the symbolic link is basically enough.

 

Okay. You only need to re-generate the following source code or modify the DLL. The DLL references will be automatically updated for each mapped website bin!

So far, I believe that all DLL reference problems have been solved!

 

Finally, I would like to share some tips with you.

If your website project requires VSS to manage the source code, remember to set the bin folder attribute under the website to hidden! Similarly, if you don't want the folder managed by VSS to be hidden, you can set its attribute to "hide!

If it is set to hidden, it will not receive VSS management! In addition, the website can still run normally and will not be affected!

This time you don't have to worry about checking out the *. dll file!

 

Many people do not know this tip. Share it with you!

 

Many people are supported and recommended. I also have a lot of tips to share with you!

 

You can also run the junction symbolic link again! Will not affect the use

 

You can also check whether the symbolic link is successfully established! There is a tool named ntfslinksview.

Go to http://download.csdn.net/source/2600855to download

My resources have been shared. For the sake of an hour, everyone will work hard to help me accumulate points!

 

 

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.