I need access to my project's assembly in C # .NET2.0.
I can see the GUID in the 'Assembly Information' dialogue under Project Properties, and at the moment I copied a const in this code. The GUID will never change, so this is not a bad solution, but it would be good to access it directly. Is there any way to do this?
Edit: People who insist on downwitting ... Unable to remove this reply as it is approved The version is. Therefore, am editing to include the correct answer (below)
If you want to get only the implemented assembly, then simple enough:
Using the system. Assembly assembly = assembly // The following line (part of the original answer) is confusing ** ** Do not use it until you want to return the system. Refining Assembly type GUID Console.WriteLine (assembly.GetType () GUID.ToString ().); // The following code is correct Var attribute = (GuidAttribute) assembly. GetCustomAttributes (typeof (GuidAttribute), true) [0]; Var id = attribute.Value;
Comments
Post a Comment