我们可以在我们的项目中部署IWSHRUNTIMELIBRARY吗? [英] Can we deploy IWSHRUNTIMELIBRARY with our project?

查看:343
本文介绍了我们可以在我们的项目中部署IWSHRUNTIMELIBRARY吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的项目中使用了IWSHRUNTIME.dll库。

I have used the IWSHRUNTIME.dll library in my project.

我的问题是如何使用我们的项目部署IWSHRUNTIME.dll库,要使用此库?

我阅读了这里
但我没有得到我的回答

My question is how can we deploy the IWSHRUNTIME.dll library with our project and also is it safe to use this library?
I have read here but I didn't get my answer

推荐答案

发布的问题没有什么意义,没有iwshruntime.dll文件。最接近的匹配是类型库IWshRuntimeLibrary的名称。它是Windows脚本宿主,您可以使用它来执行用VBScript或JScript编写的脚本。或者使用代码,你在Internet上找到使用其运行时帮助程序类型,最常见的FileSystemObject的地方。有很多这样的代码漂浮在周围,不是永远有一个很好的理由对该类型库的依赖,因为.NET有更好的选择。

The question as posted makes little sense, there is no "iwshruntime.dll" file. The closest match is the name of a type library, IWshRuntimeLibrary. It is the Windows Scripting Host, you use it to execute scripts written in VBScript or JScript. Or to use code you find on the Internet somewhere that uses one of its runtime helper types, most commonly FileSystemObject. There is a lot of that kind of code floating around, not otherwise ever a good reason to take a dependency on that type library since .NET has superior alternatives.

您可以通过添加对c:\windows \system32\wshom.ocx的引用或从COM选项卡中选择Windows Script Host Object Model来获得它。

You get it by adding a reference to c:\windows\system32\wshom.ocx or by picking "Windows Script Host Object Model" from the COM tab.

所以你最终会得到一个对wshom.ocx的运行时依赖。 从不将其部署到用户的计算机,它是Windows的一部分。以及对Interop.IWshRuntimeLibrary.dll的依赖关系,.NET Interop库包含从类型库读取的转换的COM类型。 始终希望将嵌入互操作类型属性设置为 true ,可在VS2010及更高版本上使用。这样你就不必部署interop DLL。对于VS2008和更早版本,或者当您定位早于4.0的.NET版本时,您必须部署该DLL。

So you will end up with a runtime dependency on wshom.ocx. Never deploy that one to the user's machine, it is part of Windows. And a dependency on Interop.IWshRuntimeLibrary.dll, the .NET interop library that contains the converted COM types that were read from the type library. Always favor setting the Embed Interop Types property to true, available on VS2010 and up. That way you don't have to deploy the interop DLL. For VS2008 and earlier or when you target a version of .NET that's earlier than 4.0 you do have to deploy that DLL.

这篇关于我们可以在我们的项目中部署IWSHRUNTIMELIBRARY吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆