IWshRuntimeLibrary Question

  • Thread starter Thread starter Dale Magnuson
  • Start date Start date
D

Dale Magnuson

I originally had all of my C# work on my local PC.
Because this is dangerous I moved it off to a network
drive. Since I did this I can no longer compile my code -
I get the error below.

The type or namespace name 'IWshRuntimeLibrary' could not
be found (are you missing a using directive or an assembly
reference?)

The error line is right at the begninning:

using IWshRuntimeLibrary;

I use this library to create a shortcut on the users
desktop. This worked fine when all the source was on my
local PC, but now that it is on the network I receive the
error.

Any help is greatly appreciated!

Thanks,
Dale
 
Dale,

You probably have set a reference to a COM dll in your project and the
interop assemblies that were created weren't moved when you moved your code.
Basically, there should be a dll (with Interop in the name) that was part of
your project. If you find the interop assembly and move it to the network
drive, then you should be ok.

Hope this helps.
 
Found the answer online
(http://www.codeproject.com/dotnet/shelllink.asp):

The Windows Scripting Host (WSH) enables a number of file
system and network operations to be performed from a
script file. Fortunately, it is very simple to directly
program the WSH in a .NET program by including a reference
to the WSH runtime library (IWshRuntimeLibrary). To do
this within the Visual Studio .NET IDE, do the following:
after creating a new project, right-click on the project
name within the Solution Explorer, select "Add Reference",
select the "COM" tab, find and select the "Windows Script
Host Object Model" in the listbox, click "Select", and
then click "OK". Next, include a reference to the library,
for example, within a C# file use the following: using
IWshRuntimeLibrary;

Thank you!

-----Original Message-----
Dale,

You probably have set a reference to a COM dll in your project and the
interop assemblies that were created weren't moved when you moved your code.
Basically, there should be a dll (with Interop in the name) that was part of
your project. If you find the interop assembly and move it to the network
drive, then you should be ok.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


Dale Magnuson said:
I originally had all of my C# work on my local PC.
Because this is dangerous I moved it off to a network
drive. Since I did this I can no longer compile my code -
I get the error below.

The type or namespace name 'IWshRuntimeLibrary' could not
be found (are you missing a using directive or an assembly
reference?)

The error line is right at the begninning:

using IWshRuntimeLibrary;

I use this library to create a shortcut on the users
desktop. This worked fine when all the source was on my
local PC, but now that it is on the network I receive the
error.

Any help is greatly appreciated!

Thanks,
Dale


.
 
Back
Top