.net version of dll compiled in .net core

lobsterTail

New member
Joined
Jun 3, 2023
Messages
4
Programming Experience
3-5
how would i check the .net core version of a compiled assmemly(dll). I ffound a powershell script to check .net framework dlls but don't see anything for .net core?
 
Assuming that it is a "normal" assembly built using Visual Studio or the default templates of dotnet, then it should have a TargetAssemblyAttribute set on it.

 
I liked the Regex solution posted by Derek here: Determine .NET Framework version for dll
Basically load the file as text and do regex searches for .NETCoreApp,Version=v[0-9\.]+ or .NETFramework,Version=v[0-9\.]+
 
But won't that hit false positives? For example, if that code is run against itself or some other code that has those strings, either in the code or data segments, then it would flag a match.
 
But won't that hit false positives?
Yes, it can be tricked and get a false positive.

Not by just using those strings in code, because these string are unicode and you're supposed to read the file as default UTF-8. If you did use wrong encoding Unicode and put a matching string in code, then yes, that would be read and matched, but then the actual version would not be detected.

One can also trick it by adding a key/value in embedded resource matching that pattern.

1687332741642.png
1687333219702.png


output for all matches, a .Net Fw 4.8 app:
1687332711901.png
 
Back
Top Bottom