المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Unable to reference shared assembly in GAC [modified] Solved



C# Programming
07-19-2010, 05:01 PM
This is from an example in Professional C#2008 from Wrox Chap 17, p491.

Using a VS2008 C# class library project I've created a simple shared assembly. I've used the string name tool to create a name "sn -k mykey.snk" and used the VS Project | Properties | Signing tab to sign the assembly with this key. After building, by using idlview, I can view the key in the manifest. Opening a VS Command prompt to RunAs Administrator I've installed it using "gacutil /i SharedDemo.dll".

But I can't seem to reference it from a VS2008 C# Console Application project. From Solution Explorer I right-click the solution and use Add Reference. I can find the assembly in C:\Windows\assembly using the Add Reference Browse tab but am unable to select it. The book says "... referenced in the same way as a private assembly..."

I'm not trying any Delayed Signing, just to make a compile time reference. I tried starting VS2008 with RunAs Administrator but it made no difference. Any ideas appreciated.

The assembly is in the GAC as shown by:
>gacutil /l SharedDemo
Microsoft (R) .NET Global Assembly Cache Utility. Version 3.5.21022.8 Copyright (c) Microsoft Corporation. All rights reserved.

The Global Assembly Cache contains the following assemblies:
SharedDemo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c5bbc6da95e06b44, processorArchitecture=MSIL

Number of items = 1modified on Monday, July 19, 2010 10:02 AM