Type type = typeof(System.Windows.Forms.MessageBox) ;
System.Reflection.Assembly assembly = type.Assembly;
var framework = assembly?.GetCustomAttribute<TargetFrameworkAttribute>()?.FrameworkName;
MessageBox.Show($"{assembly.GetName().ProcessorArchitecture.ToString()}-{framework}");
C#获取dll的目标框架是Core还是Framework
最新推荐文章于 2024-02-26 14:19:05 发布
该代码片段展示了如何使用C#获取WindowsFormsMessageBox的类型信息,包括调用Assembly的TargetFrameworkAttribute以获取所使用的.NET框架名,以及显示当前处理器架构。
摘要由CSDN通过智能技术生成