How to deploy a program to the global application cache (GAC) in. NET Framework 4.0)

Source: Internet
Author: User

In. NET Framework 4.0, how to deploy a program to the global application cache (GAC) has undergone considerable changes. The MSDN that comes with VS2010 is incorrectly described in some places. Below are some of my knowledge about how to deploy. NET Framework 4.0 GAC:

I used to deploy a program to GAC in the past. There are four methods. Here we will take these four methods as a clue to talk about the problems in. NET Framework 4.0.

Use Global Assembly Cache tool (Gacutil.exe ).

Note that this tool is not included in the. NET Framework runtime. It is part of the SDK. In. NET Framework 2.0, We need to download the. NET Framework 2.0 SDK separately, or install Visual Studio to have this tool;

Take my computer as an example. I installed win2008 R2 and VS2010. By default, my tool is

C: \ Program Files (x86) \ Microsoft SDKs \ Windows \ v7.0A \ Bin \ NETFX 4.0 Tools \ x64 \ gacutil.exe directory.

This is provided to me after VS2010 is installed.

This file cannot be copied to other directories. I tried to copy gacutil.exe and gacutil.exe. config to other directories, and the results won't work.

The separate. NET Framework 4.0 SDK has not yet been released. We can see on the Windows SDK blog that a new version will be released soon.

Therefore, if you use GAC to develop a. NET Framework 4.0 program, the GAC deployment method is unavailable. You cannot deploy VS2010 on the actual operating server. We only have to wait for. NET Framework 4.0 SDK.

Use Microsoft Windows Installer.

That is, we can package the components required for the entire deployment to the installation file and then install them.

For example, VS2010 provides us with many common installation methods, which can be completed step by step.

However, if you are engaged in WEB development, you will frequently publish, each time you release, each time you modify a small bug, you have to make an installation package? This is almost a very stupid practice.

 

Use Assembly Cache Viewer (Shfusion. dll ).

After installing the Windows Software Development Kit (SDK) (Visual Studio automatically installs the sdk for you) and accesses the C: \ Windows \ assembly directory, windows's Extended Assembly Cache Viewer (Shfusion. dll ). In this way, we can see the following figure. Here we can easily drag a component to GAC, or directly delete a component:

However, if you take a closer look, the above GAC does not have. NET Framework 4.0. This is because, starting from 4.0, the actual directory of GAC has changed:C: \ WINDOWS \ Microsoft. NET \ assemblyDirectory instead of C: \ Windows \ assembly. The above method is naturally useless.

Therefore, if you use GAC to develop a. NET Framework 4.0 program, the GAC deployment method is unavailable.

The error in MSDN is here. In MSDN, it is said that. NET 4.0 can still be used in this way, but it is actually not.

 

Use Mscorcfg. msc (. NET Framework Configuration Tool)

This tool is a common Microsoft. NET Framework 2.0 Configuration tool, as shown in:

However, it should be noted that. NET Framework 4.0 and later versions do not support this method. We can only use the. NET program of the previous version, namely, the. NET 1.0, 1.1, 2.0, 3.0, and 3.5 .. For more information about the reasons not supported by NET 4, see this article: Security Changes in the. NET Framework 4

When we want. NET 2.0, 3.0, 3.5 programs, we should use: "Microsoft. NET Framework 2.0 Configuration tool.. NET Framework, but in.. NET Framework 2.0 Software Development Kit (SDK.

. NET 1.0, 1.1, the corresponding version does not have this tool, but is in the NET Framework redistributable package.

Therefore, if you use GAC to develop a. NET Framework 4.0 program, the GAC deployment method is unavailable.

 

Summary

Currently, you are developing. NET Framework 4.0 programs. If you use GAC, you will suffer. You can only install the program. This is unacceptable for frequently updated WEB programs. We can upgrade the program that uses GAC to. Net Framework 4.0 only after the corresponding SDK is released.

 

 

References:

How to: Install an Assembly into the Global Assembly Cache.
Http://msdn.microsoft.com/en-us/library/dkkx7f79.aspx

Demystifying the. NET Global Assembly Cache
Http://www.codeproject.com/KB/dotnet/demystifygac.aspx

Global assembcache in. NET 4.0
Http://www.umbraworks.net/bl0g/rebuildall/2010/02/10/Global_Assembly_Cache_in_NET_4_0

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.