Can we deploy IWSHRUNTIMELIBRARY with our project?

c#-4.0, dll

Solution

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.

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.

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.

Problem

I have used the IWSHRUNTIME.dll library in my project. 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

Original source