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.
No comments:
Post a Comment