File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
managed/CounterStrikeSharp.API/Core/Plugin Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -204,6 +204,26 @@ public void Load(bool hotReload = false)
204
204
205
205
if ( Plugin == null ) throw new Exception ( "Unable to create plugin instance" ) ;
206
206
207
+ /* Version Priority order:
208
+ * ModuleVersion override
209
+ * Assembly.GetName().Version
210
+ * "<unknown>"
211
+ */
212
+ if ( Plugin is BasePlugin basePlugin )
213
+ {
214
+ // if no override we look for assembly version
215
+ if ( basePlugin . _version == "<unknown>" )
216
+ {
217
+ Version ? assemblyVersion = defaultAssembly . GetName ( ) . Version ;
218
+
219
+ // if its set, we use that, otherwise it remains "<unknown>"
220
+ if ( assemblyVersion != null )
221
+ {
222
+ basePlugin . _version = assemblyVersion . ToString ( ) ;
223
+ }
224
+ }
225
+ }
226
+
207
227
State = PluginState . Loading ;
208
228
209
229
Plugin . ModulePath = _path ;
@@ -241,4 +261,4 @@ public void Unload(bool hotReload = false)
241
261
_logger . LogInformation ( "Finished unloading plugin {Name}" , cachedName ) ;
242
262
}
243
263
}
244
- }
264
+ }
You can’t perform that action at this time.
0 commit comments