OWASP O2 Platform Blog

O2 Trick to complile with explict references

In the O2 Scripting environment there are quite a number of behind the scenes extra references that are added. If a clean/explict compilation is needed, then here is a trick to do this (note: this will be easier to do on the next version of O2)

var javascriptProxy = MoqObjects.IJavascriptProxy_Moq();   
return javascriptProxy.GetTime(); 

//O2File:C:\_WorkDir\SI\GitHub\TeamMentor 3.0\Web Applications\WebClient\WebServices\MoqObjects.cs
//using SecurityInnovation.TeamMentor.WebClient.WebServices

/*
//execute this once
CompileEngine.LocalScriptFileMappings["_Extra_methods_To_Add_to_Main_CodeBase.cs"] ="...";
CompileEngine.LocalScriptFileMappings["_extra_methods_to_add_to_main_codebase.cs"] ="...";
CompileEngine.lsGACExtraReferencesToAdd.Clear();
CompileEngine.lsGACExtraReferencesToAdd.add("System.Windows.Forms.dll");
CompileEngine.lsGACExtraReferencesToAdd.add("System.Drawing.dll");
CompileEngine.lsGACExtraReferencesToAdd.add("System.Core.dll");
CompileEngine.lsGACExtraReferencesToAdd.add("System.Xml.dll");
CompileEngine.lsGACExtraReferencesToAdd.add("O2_Kernel.dll");
CompileEngine.lsGACExtraReferencesToAdd.add("O2_Interfaces.dll");
CompileEngine.lsGACExtraReferencesToAdd.add("O2_DotNetWrappers.dll"); 
CompileEngine.lsGACExtraReferencesToAdd.add("O2_Views_ASCX.dll");
CompileEngine.lsGACExtraReferencesToAdd.add("O2_External_SharpDevelop.dll");
CompileEngine.lsGACExtraReferencesToAdd.add("O2SharpDevelop.dll");
*/
//O2Tag_OnlyAddReferencedAssemblies
//O2Ref:System.Windows.Forms.dll
//O2Ref:System.Xml.dll
//O2Ref:System.Drawing.dll
//O2Ref:System.dll
//O2Ref:O2_Kernel.dll
//O2Ref:O2_DotNetWrappers.dll
//using O2.DotNetWrappers.DotNet;
//using O2.DotNetWrappers.ExtensionMethods;    

The reason why the above script needs to be compiled like this is because there is an previously compiled O2-driven dll import added by MoqObjects.cs (whose extension methods would conflict with the ones created here)

June 16, 2011 - Posted by | .NET, O2 Internals

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: