Code Coverage by Clover.NET

VBScript

View: New views
6 Messages — Rating Filter:   Alert me  

VBScript

by Christian Strondl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

this is possibly a stupid question, because I'm not a programmer, but sometimes has to fiddle some tools...

I got a vbscript which I want to use, and I have to ad some logging capabilities. I stumbled over NLog, which seems to be exactly what I'm searching for, but when I run a test script I get the following error:
-------------------------------------------------------------------
D:\Data\Programming\VBScript\Logging>cscript Nlog_test.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

D:\Data\Programming\VBScript\Logging\Nlog_test.vbs(3, 1) Microsoft VBScript runtime error: ActiveX component can't create object: 'NLog.LogManager'

-------------------------------------------------------------------

the first lines of the script are:
-------------------------------------------------------------------
Dim logmanager, logger

Set logmanager = CreateObject("NLog.LogManager")
WScript.Echo "Loading config from file 'config8.nlog' with internal logging to console..."
logmanager.InternalLogToConsole = true
logmanager.InternalLogFile = "internal_log.txt"
logmanager.InternalLogLevel = "Info"
logmanager.LoadConfigFromFile "config8.nlog"

-------------------------------------------------------------------

I have .NET framework 1.1 and 2.0 installed (on WinXP).
Do I have to install NLog?
How?
is it possible to use it with VBScript?

many thanks in advance for your help,
christian

Re: VBScript

by Jaroslaw_Kowalski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Assuming NLog is in GAC:

C:\Windows\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe C:\Path\To\NLog.ComInterop.dll

If NLog.dll is not in GAC:

C:\Windows\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe /codebase C:\Path\To\NLog.ComInterop.dll

Re: VBScript

by Christian Strondl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

many thanks for your prompt answer. Unfortunately I didn't manage to get it to work

I run the nlog-1.0-setup.exe

I run the following command:
-------------------------------------------------
D:\Data\Programming\VBScript\Logging>"C:\Windows\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe" "C:\Program Files\NLog\bin\net-1.1\NLog.ComInterop.dll
"
Microsoft (R) .NET Framework Assembly Registration Utility 2.0.50727.42
Copyright (C) Microsoft Corporation 1998-2004.  All rights reserved.

Types registered successfully

-------------------------------------------------

my test applikation states the following:
-------------------------------------------------
D:\Data\Programming\VBScript\Logging>cscript Nlog_test.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

D:\Data\Programming\VBScript\Logging\Nlog_test.vbs(3, 1) (null): The system cannot find the file specified.

-------------------------------------------------

what did I do wrong?

many thanks again and br,
christian

Re: VBScript

by Christian Strondl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

something more:
I don't exactly know what "GAC" is, but as much as I read, I thought it would be better to use GAC, so I used the first version of your command example.

br, christian

Re: VBScript

by Jaroslaw_Kowalski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

To get NLog.dll into GAC you have to do:

c:\path\to\gacutil.exe /i c:\path\to\nlog.dll

GACUtil.exe is part of .NET Framework SDK (not the runtime).

Re: VBScript

by Christian Strondl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

thank you very much for your help. At least I got it running. I guess I have to play around to really understand it. I hope I don't have to bother you again

I'll let you know if I suceeded or not.

Again thanks and br,
christian