Pages

Monday, November 12, 2018

Virtual Box automation with C#. Part1

Test Automation and Seamless Software Integration.

On Windows hosts, one can control some of the VirtualBox Main API functionality from C# code, for system integration purpose. There are many applications where VirtualBox comes in need for software Test Automation and Seamless Software Integration. In this example let us consider stable 5.2.22 VirtualBox release.

Step1

Create Visual C# new project (in this example Console Application) and VirtualBox reference. VirtualBox is VBoxC.dll
(normally located in C:\Program Files\Oracle\VirtualBox). It is a COM dll and Virtual Box API available throughout .Net COM Interop technology.


Step2

Access to VBox COM server is managed by means of IVirtualBox interface. IMachine is a particular machine properties interface. The following C# code will iterate over all available virtual machines. 



please note to set Embed Interop Types property of Interop.VirtualBox reference to false, otherwise proxy Interop.VirtualBox.dll will not be able to load.



Result

Now we have list of virtual machines registered on the host. Hopefully .Net CTS will give you more information about virtual machines properties and methods.  


Wednesday, November 7, 2018

Delphi and C# integration


Goodbye Delphi

Its time to say goodbye to Delphi. It is important for your company to jump into this century and experience benefits such as .Net C#

Thanks to innovation initiative of RemObjects, it becomes possible to move lots of legacy code implemented in Delphi into .Net platform.

Oxygene is a language that is decidedly Object Pascal, and will make you feel immediately at home if you come from a Delphi or Object Pascal background, but at the same time is a modern language for the 21st century, with many, many advanced language features that take your productivity to the next level.

Let us jump into migration your VCL Delphi forms into .NET assembly for C#.

Step1 - build Delphi-WPF.dll which is part of DelphiRTL project

Step2 - build MyOxygeneForms.dll which is Oxygene-Delphi resource assembly with your Delphi VCL forms. With a little efforts existing *.pas/*.dfm Delphi files can be ported into Oxygene language and included into elements assembly. You can edit *.pas/*.dfm in RAD Studio Delphi and then attach them to MyOxygeneForms.dll assembly. This allows you to move tons of your existing Delphi code into .Net and manage VCL objects from other .NET languages.





Step3 - build Visual C# WPF application and start to use MyOxygeneForms.dll(or YourOxygeneForms.dll  😊 )

VCL form components are now available for use in C#


Enjoy your Delphi code on .Net platform and be prepared to move there.



Source code of the Delphi-C# integration example is available for download here