Yep, even with the current OxideMod sources, if I switch this area in Extensions/Oxide.CSharp/Compilation.cs
With thisCode:if (match.Success) { var result = match.Groups[1].Value; if (result.StartsWith("Oxide.")) AddReference(plugin, Regex.Replace(result, @"Oxide\.[\w]+\.([\w]+)", "Oxide.$1")); else AddReference(plugin, result); continue; }
My extension works like beforeCode:if (match.Success) { AddReference(plugin, match.Groups[1].Value); continue; }
[DOUBLEPOST=1508651730][/DOUBLEPOST]I'm glad to update my stuff however is needed to make it compliant with current design. I'll press on with this new information. Thanks!
Custom extension not loading after update
Discussion in 'Rust Development' started by Kolyma, Oct 21, 2017.
-
Wulf Community Admin
-
Code:
using Network; using System; using Oxide.Ext.MyExt.Libraries; using Oxide.Core.Libraries;
-
Wulf Community Admin
-
That was just how it all started for me because originally, I copied the MySQL implementation as a framework to create my extension. The Oxide. came with it
-
So here are 2 "official" 3rd-party extensions. The first seems to use the same namespace'ing as mine
Code:using Oxide.Core; using Oxide.Core.Extensions; using Oxide.Core.Libraries; using Oxide.Core.Plugins; using Oxide.Ext.IRC.Libraries; using Oxide.Plugins; using System; using System.Collections.Generic; using System.Reflection; using System.Threading;namespace Oxide.Ext.IRC {
Code:using A; using ConVar; using Newtonsoft.Json.Linq; using Oxide.Core; using Oxide.Core.Extensions; using Oxide.Core.Logging; using System; using System.Reflection; using System.Runtime.CompilerServices; using System.Text; using System.Threading;namespace RustIO.Oxide {
-
GOT IT.
The solution for me required several changes:
- In my extension file MyExtension.cs, I had to change:
Code:namespace Oxide.Ext.MyExt
Code:namespace Ext.MyExt
- In the accompanying extension file MyExt.cs, I had to change: Code:
namespace Oxide.Ext.MyExt.Libraries
Code:namespace Ext.MyExt.Libraries
- For the project properties in MSVC of MyExt.csproj, I had to change both the "Assembly name:" and "Default namespace" from: Code:
Oxide.Ext.MyExt
Code:Ext.MyExt
- Then in my actual plugin MyExtUniversal.cs, I had to add to the top: Code:
// Reference: Ext.MyExt
- And change Code:
using Oxide.Ext.MyExt.Libraries;
Code:using Ext.MyExt.Libraries;
I don't think this trouble of mine warrants a GitHub issue since it seems you clearly meant to make this code change to the extension reference handling code, so I won't start one. It's more of a user implementation issue.
I am curious if the whole "// Reference: Blah.Blah.Blah" is documented somewhere? Or better yet, a brief but comprehensive description of how to properly implement an OxideMod extension?
Thanks for your help!Last edited by a moderator: Oct 23, 2017 - In my extension file MyExtension.cs, I had to change:
-
Wulf Community Admin
The // Reference was added awhile back and never really documented, and was mainly there to reference DLLs manually added and those that aren't referenced by Oxide itself so that plugins can make use of them. We now keep default references for each game extension for common DLLs that plugins may and do use, as well as all of the core extensions. -
Wulf Community Admin
Are you still having any issues on the latest builds?
-
-
Extension namespace:
Code:namespace Ext.UI
Code:// Reference: Ext.UIusing Ext.UI.Libraries; using Ext.UI;
One named Ext.UI.DLL and another named Oxide.Ext.UI.DLL
Oxide/Compilation.cs at 6ffe28cd16a59c6a3ccbbb80e1ccc935d667fdd7 · OxideMod/Oxide · GitHub
Which prevents references to any extension starting with Oxide.
and
Oxide/ExtensionManager.cs at 10f96237ad116e3479c8035552cfeebf0316e075 · OxideMod/Oxide · GitHub
Which only loads extensions that DO start with Oxide.
So by including a copy of the extension without the Oxide. the Compilation.cs file is able to reference my library while the ExtensionManager loads the dll with Oxide. -
Wulf Community Admin
To explain how Oxide currently handles it:
- If extensions prefixed with "Oxide.", they are automatically detected and loaded at startup; manually loading them is unnecessary.
- If "// Reference: X" is detected in a plugin, it ignores "Oxide." and a couple other DLLs that are already referenced by default in Oxide (all extensions are referenced based on using statements and default references). The select "// Reference" ignoring was added because of this, as it can cause some issues by trying to reference non-existent DLLs and conflicting dependencies.
- If "using Oxide.*" is detected, then Oxide attempts to look and load DLLs that match that namespace if not already loaded. So by not having your extension's namespace prefixed with that, it isn't automatically loaded.
-
This issue was compounded when I used the Oxide.* namespace. It just looped errors when I attempted to load the plugin. -
Wulf Community Admin
-
Code:Build Date: 10/26/2017 15:33:59 Unity Version: 2017.1.2f1 Changeset: 23539 Branch: main Oxide Version: 2.0.3681
-
-
Wulf Community Admin
-
-
Wulf Community Admin
-