为什么我的组件不与QUOT可见;添加引用>净"当安装到GAC?我的、不与、组件、GAC

2023-09-04 01:03:44 作者:热情喂冷风

只要有关于GAC 一个快速的问题 我创建了一个集Awesome.DLL。没有签署,然后安装到GAC:

Just have a quick question about the GAC I created an assembly Awesome.DLL. Had it signed, then installed into the GAC:

C:\MyApps\Awesome\Awesome\Awesome\bin\Release>sn -k Awesome.snk
Microsoft (R) .NET Framework Strong Name Utility  Version 4.0.30319.1 
Copyright (c) Microsoft Corporation.  All rights reserved.

Key pair written to Awesome.snk

C:\MyApps\Awesome\Awesome\Awesome\bin\Release>gacutil /i Awesome.dll 
Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.1 
Copyright (c) Microsoft Corporation.  All rights reserved.

Assembly successfully added to the cache

C:\MyApps\Awesome\Awesome\Awesome\bin\Release>gacutil /l Awesome.dll 
Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.1 
Copyright (c) Microsoft Corporation.  All rights reserved.

The Global Assembly Cache contains the following assemblies:

Number of items = 0

我的问题:

Awesome.DLL没有在找到C:\ WINDOWS \大会或子文件夹。研究发现,尽管在 C:\ WINDOWS \ Microsoft.NET \组装\ GAC_MSIL \ 我想这是因为,我无法看到Awesome.DLL从添加引用> .NET。

Awesome.DLL is not found in C:\Windows\Assembly or any of the sub folders. It is found, though in C:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL\ I guess because of this, I am not able to see Awesome.DLL from Add Reference > .Net.

为何不安装到 C:\ WINDOWS \大会\ ?我怎么可以指向该位置呢?

Why does it not install to C:\Windows\Assembly\? How can i point to that location instead?

推荐答案

您的组件安装到 C:\ WINDOWS \ Microsoft.NET \装配\ 而不是 C:\ WINDOWS \大会\ ,因为它是一个.NET 4.0组件和.NET Framework 4.0版本有一个新的独立的广汽在该位置。位于海关总署C:\ WINDOWS \大会\ 只包含NET 2.0 - 3.5组件。 (见 .NET 4.0中有一个新的GAC,为什么呢? )。

Your assembly is installed to C:\WINDOWS\Microsoft.NET\assembly\ instead of C:\Windows\Assembly\ because it is a .Net 4.0 assembly and the .Net framework version 4.0 has a new separate GAC in that location. The GAC located at C:\Windows\Assembly\ contains only .Net 2.0 - 3.5 assemblies. (see .NET 4.0 has a new GAC, why?).

在视觉工作室中组件列表中选择添加引用 - > .NET。对话不只是在GAC中程序集的列表(注意,大多数在该列表中的条目都没有在GAC发现无论是)。

The list of assemblies found in Visual Studios "Add Reference -> .Net." dialog is not simply a list of assemblies found in the GAC (notice that most of the entries in that list aren't found in the GAC either).

有关如何将组件添加到这个列表,请参阅下面的文章(尤其是要显示在添加引用对话框中的组件一节)的信息:

For information on how to add your assembly to this list see the following article (specifically the "To display an assembly in the Add Reference dialog box" section):

如何添加或删除在Visual Studio中引用

请注意用于此注册表项是不同版本的Visual Studio不同。

Note that the registry key used for this is different for different versions of Visual Studio.

 
精彩推荐
图片推荐