Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't access the assembly that installed into the GAC
    text
    copied!<p>I am sorry if this is stupid questions, but i've spend two days on this, and can't get it to work. Here's what I did:</p> <ol> <li>Create a new class library project</li> <li>Added a simple method <code>sayHi()</code> that returns a string </li> <li>In the project properties checked "sign the assembly" and used a strong name key file</li> <li>Compiled the application and copied the DLL to c:\windows\assemblies (and i also tried using the gacutil tool with similar results)</li> <li>Added the following to machine.config <code>&lt;compilation&gt;&lt;assemblies&gt;&lt;add assembly="gacTestClass, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31418215e131202e" /&gt;</code>. This works just fine, because if i misspell the assembly name, any .net app will fail and complain about that line. </li> <li>Using the assembly cache viewer in the .NET framework configuration tool i can see the assembly in the cache. </li> <li>Now, when i try to use that, my app fails when i do either <code>using gacTestClass</code> or <code>gacTestClass.gacTest.sayHi()</code>. I get an error saying that the type or namespace could not be found. </li> </ol> <p>Any help is appreciated. </p> <p>EDIT:</p> <p>Ok, i followed a suggestion and I will try to make this work with web.config, rather than machine.config. </p> <p>I added the following to my web.config <code>&lt;compilation&gt;&lt;assemblies&gt;&lt;add assembly="gacTestClass, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31418215e131202e" /&gt;</code> and made sure that it works by misspelling the name, and watching the app fail. Now, when I try to add <code>using gacTestClass</code> to the top of my .cs file, i get an error saying that the type or namespace could not be found. </p> <p>Just in case, here's the code the for the gacTestClass</p> <pre><code>using System; using System.Collections.Generic; using System.Text; using System.Reflection; [assmbly:AssemblyKeyFile("sayHi.snk")] namespace gacTestClass { public class gacTest { public string sayHi() { return "Hello there!"; } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload