A tool to view C++/CLI assembly attributes

C

cristalink

Hi,

I have a C++/CLI DLL which I marked with [assembly:
AssemblyVersionAttribute( "1.0.0.0" )] in a cpp file. Is there a standard
tool from Microsoft that takes a .DLL file and displays all the .NET
attributes of the assembly?

Thanks,

John
 
P

Pavel Minaev

cristalink said:
Hi,

I have a C++/CLI DLL which I marked with [assembly:
AssemblyVersionAttribute( "1.0.0.0" )] in a cpp file. Is there a standard
tool from Microsoft that takes a .DLL file and displays all the .NET
attributes of the assembly?

ildasm.exe will do that (aside from anything else it does).
 
J

Jialiang Ge [MSFT]

Good morning John. Welcome to Microsoft Newsgroup Support service! My name
is Jialiang Ge [MSFT]. It's my pleasure to work with you on this issue.

As Pavel mentioned, ildasm.exe (MSIL Disassembler) is one standard tool
from Microsoft that can view all the .NET attributes of an assembly. You
can find it in .NET Framework SDK.

MSIL Disassembler (Ildasm.exe)
http://msdn.microsoft.com/en-us/library/f7dy01k1(VS.80).aspx

Ildasm.exe Tutorial (this tutorial is for .NET 1.1, but it also works for
.NET 2.0 and later)
http://msdn.microsoft.com/en-us/library/aa309387.aspx

In the menu File->Open of ildasm, we could locate the C++/CLI dll, load it.
Then in the View menu -> MetaInfo -> Show!, it would display all the
metadata info in the .NET assembly, including our AssemblyVersionAttribute
("1.0.0.0"):

CustomAttribute #7 (0c000043)
-------------------------------------------------------
CustomAttribute Type: 0a000005
CustomAttributeName: System.Reflection.AssemblyVersionAttribute :: instance
void .ctor(class System.String)
Length: 12
Value : 01 00 07 31 2e 30 2e 30 2e 30 00 00 > 1.0.0.0 <
ctor args: ("1.0.0.0")

One thing to be noticed is that, although most attributes in AssemblyInfo
can be found in the manifest, AssemblyVersionAttribute is an exception.
Compilers emit specific metadata for AssemblyVersionAttribute, rather than
emiting the custom attributes themselves. For more details, see the article:
http://blogs.msdn.com/adam_nathan/archive/2003/04/29/56645.aspx

John, please try it and let us know whether it's helpful to you.

Apart from ildasm, I'd like to share some other useful resources with you
to look at whenever you find free time. You might have come across these
before but it is just for your reference.

1. A commonly used tool: .NET Reflector
http://www.red-gate.com/products/reflector/
The original writer of the tool, Lutz Roeder, is a Microsoft engineer. In
the recent days, he declared to transfer the development of the tool to Red
Gate: http://blog.lutzroeder.com/

.NET Reflector can easily disassemble any .NET assembly. You could see the
AssemblyVersionAttribute["1.0.0.0"] by loading the .NET assembly,
right-clicking on the resultant node in reflector, and choose "Disassemble".

2. Assembly Viewer
http://www.codeproject.com/KB/dotnet/asmex.aspx
An open source solution to view the .NET assembly metadata. It contains the
source code to parse a .NET assembly.

3. PEBrowsePro
http://www.smidgeonsoft.prohosting.com/
PEBrowsePro can not only analyze .NET meta, it also does a very good job to
parse native images.

And more...

In addition, if you are interested in how to do the above programmatically
in future, you may want to have a look at this online book:
http://www.vijaymukhi.com/documents/books/metadata/
or refer to the source code in Assembly Viewer
http://www.codeproject.com/KB/dotnet/asmex.aspx

Have a nice day!

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top