title: Unable to get the list of custom attributes from a DLL
body: <p>I have a small requirement and there seems to be some trouble in accomplishing it.Please know that I'm a newbie in c# and this is an assignment given to me i kindly request you all to help me with it with a most prompt reply for i have already crossed my deadlines for this assignment.</p>
  
  <p>I have a dll and there is a custom attribute defined in it i want to be able to retrieve all the methods from the class that uses this custom attribute.please note i have to get the method names from the built dll referenced from another application.</p>
  
  <p>Here is the code for better clarity.</p>
  
  <p>MY attribute class:</p>
  
  <pre><code>namespace model
  {
      [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false)]
      public sealed class Class1: Attribute
      {
          public Class1()
          {}
          public Class1(string helptext)
          { }
          public string HelpText { get; internal set; }
      }
  }
  </code></pre>
  
  <p>The class that uses this attribute and that is going to be extracted after being built as a DLL</p>
  
  <pre><code>private void Form1_Load(object sender, EventArgs e)
      {
         Assembly mydllAssembly = Assembly.LoadFile(@"D:\Windowsservice\BasicMEthods\BasicMEthods\bin\Debug\BasicMEthods.dll");
          Type mydllFormType = mydllAssembly.GetType("BasicMEthods.Transforms",true);
          MemberInfo info = mydllFormType;
           Attribute[] attrs = (Attribute[])info.GetCustomAttributes(true);
              foreach (Attribute  att in attrs)
              {
                   MethodInfo[] myArrayMethodInfo1 = mydllFormType.GetMethods(BindingFlags.Public);
                      for (int i = 0; i &lt; myArrayMethodInfo1.Length; i++)
                      {
                          MethodInfo mymethodinfo = (MethodInfo)myArrayMethodInfo1[i];
                          textBox1.Text = mymethodinfo.ToString();
                      }
              }
          }
  }
  </code></pre>
  
  <p>an error is thrown at this line of the code  </p>
  
  <pre><code>Attribute[] attrs = (Attribute[])info.GetCustomAttributes(true);
  </code></pre>
  
  <p>which says </p>
  
  <blockquote>
    <p>"Could not load file or assembly 'model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified." </p>
  </blockquote>
  
  <p>The dll is being fetched from the specified location and I'm able to see the class transforms in the quick watch I dont know why this error is thrown... and also I don't know how i can get to access the attributes defined in the dll....Please help</p>