简体   繁体   English

是否有适用于VMware VIX API的C#包装器?

[英]Is there a C# wrapper for the VMware VIX API?

I am using VMware Workstation 6.5 on Windows Vista x64. 我在Windows Vista x64上使用VMware Workstation 6.5。 I would like to automate some of the VM management tasks. 我想自动执行一些VM管理任务。 I know that there is a COM API ( http://www.vmware.com/support/developer/vix-api/ ) available which I could use directly. 我知道有一个可以直接使用的COM API( http://www.vmware.com/support/developer/vix-api/ )。

Is there a C# wrapper for this COM API? 这个COM API有一个C#包装器吗?

Thanks, 谢谢,

Arnie 阿尼

现在有一个很好的库可以解决这个问题: http//www.codeproject.com/KB/library/VMWareTasks.aspx

VMWareTasks是VixCOM的完整包装器: http ://vmwaretasks.codeplex.com

ArnieZ. ArnieZ。

Any COM DLL can be used from .NET. 任何COM DLL都可以在.NET中使用。 Adding it as reference in visual studio will generate a DLL called 在visual studio中添加它作为参考将生成一个名为的DLL

"YourDll.Interop.dll" “YourDll.Interop.dll”

This is a .NET -> COM marshaling library, and will do what you need. 这是一个.NET - > COM编组库,可以满足您的需求。

You can also generate this from the command line using tlbimp.exe 您也可以使用tlbimp.exe从命令行生成此命令

Of course, you'll have to keep in mind that you are invoking COM components, and remember to use the .NET Marshaling API to decrease reference counts when you are done using them, otherwise you will cause memory leaks. 当然,您必须记住您正在调用COM组件,并且记得在完成使用它们时使用.NET Marshaling API来减少引用计数,否则会导致内存泄漏。

I've wrapped the interop implementation in another library that implements IDisposable on its objects so that cleanup is handled automatically before, but if it is a large library, this might not be worth the effort. 我已经将interop实现包装在另一个在其对象上实现IDisposable的库中,以便之前自动处理清理,但如果它是一个大型库,这可能不值得付出努力。

How 'bout adding a reference to this API in your VS.Net and let VS.Net create a managed wrapper for you? 如何在VS.Net中添加对此API的引用并让VS.Net为您创建托管包装器? I'm not aware of any "managed" API for this. 我不知道任何“托管”API。 Let me know if you find it :) 如果你发现它,请告诉我:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM