<div>Justin,</div>
<div> </div>
<div>Thanks for pointing me in a direction, this was -very- helpful. It wasn't nearly as straightforward as I was expecting, but it did give me the opportunity/excuse to get my hands dirty and dig into the projects and code a bit. I'm going to document the process a bit here, so it gets archived for future reference. I'm pretty sure I've narrowed down the steps needed.<br>
</div>
<div>The actual project that needs the assembly reference added to it is OpenSim.Region.ScriptEngine.Shared.CodeTools, but this is just the start. This gets the assembly detectable by the compiler. The next step is adding the reference to the script being compiled. In OpenSim.Region.ScriptEngine.Shared.CodeTools.Compiler (Compiler.cs), in the function <font size="2">CompileFromDotNetText, there is a section where ReferencedAssemblies are added to the compiler as parameters, and the assembly needs to be added here as well. For example, to add a standard library, the following line would be used:</font></div>
<div><font size="2"></font> </div>
<div><font size="2">parameters.ReferencedAssemblies.Add(</font><font color="#a31515" size="2"><font color="#a31515" size="2">"System.dll"</font></font><font size="2">);</font></div>
<div> </div>
<div>Which, it turns out, I needed to do, as System.dll isn't added by default, and our test script included a try/catch where Exception was not detected as a type. To add something like the MySql dll that comes with OpenSim, it would look like this:</div>
<div><font size="2">
<p>parameters.ReferencedAssemblies.Add(</p></font><font color="#2b91af" size="2"><font color="#2b91af" size="2">Path</font></font><font size="2">.Combine(rootPath,</font><font color="#a31515" size="2"><font color="#a31515" size="2">"MySql.Data.dll"</font></font><font size="2">));</font>The script engine automatically wraps scripts in boilerplate code to put them inside a class and make them compilable. This has the side-effect of making "using" or "import" statements inside scripts impossible, so these also need to be added to the code. <br>
</div>
<div>For example, if your script is C#, then the function to alter is <font size="2">CreateCSCompilerScript (in the same Compile.cs), adding the using statement to the list inside this function.</font></div>
<div> </div>
<div>If I get the chance later this summer, I may try to develop a more robust system that attempts to (at the very least) detect the default mono/.net libraries and automatically adjust this boilerplate to include them...</div>
<div> </div>
<div>Again, thanks for the help!</div>
<div> </div>
<div>--Jeremy Lothian</div>
<div> </div>
<div class="gmail_quote">On Fri, May 14, 2010 at 9:19 PM, Justin Clark-Casey <span dir="ltr"><<a href="mailto:jjustincc@googlemail.com">jjustincc@googlemail.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div class="im">J Lothian wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Greetings,<br> I'm a developer working on a research project that we are migrating from Second Life to OpenSim. We're currently exploring options and new features that may be available in OpenSim that we did not have in Second Life. One of these items is the ability to add a custom assembly reference to be available for scripts within the scripting engine (in C# mode). I am very unfamiliar with the mono/nant build process. I searched for this question a bit and couldn't find anything very related. Could someone point me towards which files I should be looking at to add an assembly reference? Is this even possible? Also, apologies if this is the wrong list, I wasn't sure if this was a user or developer question.<br>
</blockquote><br></div>If you want to directly call your own C# assembly from within C# scripts, then I believe that you would have to explicitly add those assemblies to prebuild.xml before regenerating the solution files with <a href="http://prebuild.sh/prebuild.bat" target="_blank">prebuild.sh/prebuild.bat</a>. <br>
The project you would need to add to is OpenSim.Region.ScriptEngine.Shared.Api, I think. However, some of this is supposition - I've never tried this before. I don't think there is any documentation on it.<br><font color="#888888"><br>
-- <br>Justin Clark-Casey (justincc)<br><a href="http://justincc.org/" target="_blank">http://justincc.org</a><br><a href="http://twitter.com/justincc" target="_blank">http://twitter.com/justincc</a><br>_______________________________________________<br>
Opensim-dev mailing list<br><a href="mailto:Opensim-dev@lists.berlios.de" target="_blank">Opensim-dev@lists.berlios.de</a><br><a href="https://lists.berlios.de/mailman/listinfo/opensim-dev" target="_blank">https://lists.berlios.de/mailman/listinfo/opensim-dev</a><br>
</font></blockquote></div><br>