I have a .NET Core app which sets metadata properties during build, using standard options in the .csproj:
<Project>
<PropertyGroup>
<Product>MyCoolProduct</Product>
<Version>0.1.1</Version>
</PropertyGroup>
<snip />
</Project>
On Windows, this is easy enough to retrieve from the compiled .dll either in Explorer, or via a PowerShell script. How can I do something similar on Linux? Ideally, I'd like to be able run a simple command like dotnet inspect my.dll
and get a summary of metadata for that assembly, but what's the next best thing?
I use exiftool
:
$ exiftool /usr/lib64/dotnet/sdk/2.0.3/Microsoft/Microsoft.NET.Build.Extensions/tools/netcoreapp1.0/System.Threading.dll | grep -i version
ExifTool Version Number : 10.55
Linker Version : 48.0
OS Version : 4.0
Image Version : 0.0
Subsystem Version : 4.0
File Version Number : 4.6.24705.1
Product Version Number : 0.0.0.0
File Version : 4.6.24705.01
Product Version : 4.6.24705.01. Commit Hash: 4d1af962ca0fede10beb01d197367c2f90e92c97
Assembly Version : 4.0.12.0
Originally discovered from here.
Watch out, though. It doesn't work on crossgen
ed stuff:
$ exiftool /usr/lib64/dotnet/sdk/2.0.3/Roslyn/Microsoft.CodeAnalysis.dll
ExifTool Version Number : 10.55
File Name : Microsoft.CodeAnalysis.dll
Directory : /usr/lib64/dotnet/sdk/2.0.3/Roslyn
File Size : 4.6 MB
File Modification Date/Time : 2018:01:24 13:12:48-05:00
File Access Date/Time : 2018:02:01 12:37:59-05:00
File Inode Change Date/Time : 2018:01:26 09:52:23-05:00
File Permissions : rw-r--r--
Error : File format error
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With