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

查看:97
本文介绍了我们可以在项目中部署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 的引用,或者从Windows脚本宿主对象模型中选择 COM选项卡。

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 从不 c c c Interop 库,其中包含从类型库读取的转换的COM类型。

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.

始终喜欢将Embed Interop Types属性设置为 true ,可在VS2010及更高版本上使用。这样你就不必部署互操作DLL。对于VS2008和更早版本,或者当您定位的版本早于4.0版本时,您必须部署该DLL。

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天全站免登陆