The title says it all.
Since, it's possible for anyone to name an assembly starting with 'System', checking for 'System' is not a satisfactory solution.
Alternatively, if that's not possible, how about checking the modules in an assembly?
The title says it all.
Since, it's possible for anyone to name an assembly starting with 'System', checking for 'System' is not a satisfactory solution.
Alternatively, if that's not possible, how about checking the modules in an assembly?
All .NET assemblies might have the same public key token: b77a5c561934e089
It is a moving target. For example, the PrintForm component wasn't originally part of the framework install set, but it is in .NET 3.5 SP1. The very best thing to do is to not ask the question, you'll get in trouble some day when you do.
If you're not too concerned with security then you could simply check the path
Console.WriteLine(typeof(File).Assembly.Location.EndsWith(@"Microsoft.NET\Framework64\v2.0.50727\mscorlib.dll"));
Otherwise, as already suggested, the public key token on the fullname would be safest:
Console.WriteLine(typeof(File).Assembly.FullName.Contains("PublicKeyToken=b77a5c561934e089"));