I have the following code in assembly A:
[AttributeUsage(AttributeTargets.Assembly)]
public class AssemblyCategoryAttribute : Attribute {
public string Category { get; set; }
public AssemblyCategoryAttribute(string category) {
Category = category;
}
}
Assembly B references assembly A and has this attribute applied. Finally assembly C also references assembly A and has the following code:
var assembly = Assembly.LoadFrom("..."); // Get assembly B
var description = assembly.GetCustomAttributes(false).OfType<AssemblyDescriptionAttribute>().SingleOrDefault();
var category = assembly.GetCustomAttributes(false).OfType<AssemblyCategoryAttribute>().SingleOrDefault();
However it gets the description fine but the category returns null. I'd appreciate it if someone could help me solve this. Thanks
Edit
As requested in the comments, here's my AssemblyInfo.cs file in assembly B:
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using AssemblyANameSpace;
[assembly: AssemblyTitle("Name")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCategory("Core")]
...