@@ -15,7 +15,7 @@ public ProcessWrapper(Process process, IntPtr windowHandle)
15
15
16
16
this . Bitness = GetBitnessAsString ( this . Process ) ;
17
17
18
- this . SupportedFrameworkName = GetTargetFramework ( process ) ;
18
+ this . SupportedFrameworkName = GetSupportedTargetFramework ( process ) ;
19
19
}
20
20
21
21
public static string GetBitnessAsString ( Process process )
@@ -71,18 +71,25 @@ private static Process GetProcessFromWindowHandle(IntPtr windowHandle)
71
71
return null ;
72
72
}
73
73
74
- private static string GetTargetFramework ( Process process )
74
+ private static string GetSupportedTargetFramework ( Process process )
75
75
{
76
76
var modules = NativeMethods . GetModules ( process ) ;
77
77
78
78
var wpfgfx_cor3Found = false ;
79
- FileVersionInfo hostFxrVersionInfo = null ;
79
+ FileVersionInfo hostPolicyVersionInfo = null ;
80
80
81
81
foreach ( var module in modules )
82
82
{
83
- if ( module . szModule . Equals ( "hostfxr.dll" , StringComparison . OrdinalIgnoreCase ) )
83
+ #if DEBUG
84
+ Trace . WriteLine ( module . szExePath ) ;
85
+ var fileVersionInfo = FileVersionInfo . GetVersionInfo ( module . szExePath ) ;
86
+ Trace . WriteLine ( $ "File: { fileVersionInfo . FileMajorPart } .{ fileVersionInfo . FileMinorPart } ") ;
87
+ Trace . WriteLine ( $ "Prod: { fileVersionInfo . ProductMajorPart } .{ fileVersionInfo . ProductMinorPart } ") ;
88
+ #endif
89
+
90
+ if ( module . szModule . StartsWith ( "hostpolicy.dll" , StringComparison . OrdinalIgnoreCase ) )
84
91
{
85
- hostFxrVersionInfo = FileVersionInfo . GetVersionInfo ( module . szExePath ) ;
92
+ hostPolicyVersionInfo = FileVersionInfo . GetVersionInfo ( module . szExePath ) ;
86
93
}
87
94
88
95
if ( module . szModule . StartsWith ( "wpfgfx_cor3.dll" , StringComparison . OrdinalIgnoreCase ) )
@@ -91,30 +98,28 @@ private static string GetTargetFramework(Process process)
91
98
}
92
99
93
100
if ( wpfgfx_cor3Found
94
- && ! ( hostFxrVersionInfo is null ) )
101
+ && hostPolicyVersionInfo != null )
95
102
{
96
103
break ;
97
104
}
98
105
}
99
106
100
107
if ( wpfgfx_cor3Found )
101
108
{
102
- if ( hostFxrVersionInfo == null )
109
+ switch ( hostPolicyVersionInfo ? . ProductMajorPart )
103
110
{
104
- return "netcoreapp3.0" ;
105
- }
111
+ case 5 :
112
+ // we currently map from net 5 to netcoreapp 3.1
113
+ return "netcoreapp3.1" ; //return "net5.0";
114
+
115
+ case 3 when hostPolicyVersionInfo . ProductMinorPart >= 1 :
116
+ return "netcoreapp3.1" ;
106
117
107
- switch ( hostFxrVersionInfo . FileMajorPart )
108
- {
109
118
case 3 :
110
- if ( hostFxrVersionInfo . FileMinorPart >= 100 )
111
- {
112
- return "netcoreapp3.1" ;
113
- }
114
- else
115
- {
116
- return "netcoreapp3.0" ;
117
- }
119
+ return "netcoreapp3.0" ;
120
+
121
+ default :
122
+ return "netcoreapp3.0" ;
118
123
}
119
124
}
120
125
0 commit comments