Пример #1
0
 public Version TryGetDotNetCoreVersion(ModuleDef module)
 {
     if (TargetFrameworkAttributeInfo.TryCreateTargetFrameworkInfo(module, out var info) && info.IsDotNetCore)
     {
         return(info.Version);
     }
     return(null);
 }
        public static bool TryCreateTargetFrameworkInfo(ModuleDef module, out TargetFrameworkAttributeInfo info)
        {
            var asm = module?.Assembly;

            if (asm != null)
            {
                if (asm.TryGetOriginalTargetFrameworkAttribute(out var framework, out var version, out var profile))
                {
                    info = new TargetFrameworkAttributeInfo(framework, version, profile);
                    return(true);
                }
            }
            info = default;
            return(false);
        }