How do I create a COM wrapper for C# or Jscript.NET, so I can use it in WSH? 
Author Message
 How do I create a COM wrapper for C# or Jscript.NET, so I can use it in WSH?

I'd like to make a COM wrapper, so I can call some of the advanced EventLog
features supported in the .NET framework.  Does someone have detailed
instructions on how to write a COM wrapper?  I have VS.NET.  I can compile
DLLs, but when I try and use regsvr32, I get an error message that the DLL
can't be registered.  I suspect I don't have all the code needed for a COM
object.

--
Eric Chamberlain, CISSP



Sat, 02 Apr 2005 09:42:22 GMT  
 How do I create a COM wrapper for C# or Jscript.NET, so I can use it in WSH?
Eric,

Hi.  Welcome to the club.  I've kvetched about that elsewhere.  The migration
wizard for VB projects doesn't help either; the scriptable COM interfaces appear
to go away when you use it.


Eric Chamberlain typed:

Quote:
> I'd like to make a COM wrapper, so I can call some of the advanced
> EventLog features supported in the .NET framework.  Does someone have
> detailed instructions on how to write a COM wrapper?  I have VS.NET.
> I can compile DLLs, but when I try and use regsvr32, I get an error
> message that the DLL can't be registered.  I suspect I don't have all
> the code needed for a COM object.

--
Please respond in the newsgroup so everyone may benefit.
 http://dev.remotenetworktechnology.com
 ----------
 Subscribe to Microsoft's Security Bulletins:
 http://www.microsoft.com/technet/security/bulletin/notify.asp


Sat, 02 Apr 2005 11:31:03 GMT  
 How do I create a COM wrapper for C# or Jscript.NET, so I can use it in WSH?
The subject appears to be coming up more frequently in the dotnet newsgroups
lately.  I did a scan on microsoft.public.dotnet.* newsgroups via Google using
"late bound" as a term, and got a few semi-relevant hits.

Targeted a bit towards forms, but still explaining the general process:
http://groups.google.com/groups?selm=OV4LlWqQCHA.4248%40tkmsftngp08


Eric Chamberlain typed:

Quote:
> I'd like to make a COM wrapper, so I can call some of the advanced
> EventLog features supported in the .NET framework.  Does someone have
> detailed instructions on how to write a COM wrapper?  I have VS.NET.
> I can compile DLLs, but when I try and use regsvr32, I get an error
> message that the DLL can't be registered.  I suspect I don't have all
> the code needed for a COM object.

--
Please respond in the newsgroup so everyone may benefit.
 http://dev.remotenetworktechnology.com
 ----------
 Subscribe to Microsoft's Security Bulletins:
 http://www.microsoft.com/technet/security/bulletin/notify.asp


Sat, 02 Apr 2005 11:47:32 GMT  
 How do I create a COM wrapper for C# or Jscript.NET, so I can use it in WSH?
I wonder if it would be easier to convert all our VBScript to jscript.NET.

--
Eric Chamberlain, CISSP



Quote:
> Eric,

> Hi.  Welcome to the club.  I've kvetched about that elsewhere.  The
migration
> wizard for VB projects doesn't help either; the scriptable COM interfaces
appear
> to go away when you use it.


> Eric Chamberlain typed:
> > I'd like to make a COM wrapper, so I can call some of the advanced
> > EventLog features supported in the .NET framework.  Does someone have
> > detailed instructions on how to write a COM wrapper?  I have VS.NET.
> > I can compile DLLs, but when I try and use regsvr32, I get an error
> > message that the DLL can't be registered.  I suspect I don't have all
> > the code needed for a COM object.

> --
> Please respond in the newsgroup so everyone may benefit.
>  http://dev.remotenetworktechnology.com
>  ----------
>  Subscribe to Microsoft's Security Bulletins:
>  http://www.microsoft.com/technet/security/bulletin/notify.asp



Sat, 02 Apr 2005 12:37:56 GMT  
 How do I create a COM wrapper for C# or Jscript.NET, so I can use it in WSH?
Things work much better the other way round, i.e. using unmanaged typlibs with
.net / C# (tlbimp.exe).
 - Michel Gallant   MVP Security
Quote:

> I'd like to make a COM wrapper, so I can call some of the advanced EventLog
> features supported in the .NET framework.  Does someone have detailed
> instructions on how to write a COM wrapper?  I have VS.NET.  I can compile
> DLLs, but when I try and use regsvr32, I get an error message that the DLL
> can't be registered.  I suspect I don't have all the code needed for a COM
> object.

> --
> Eric Chamberlain, CISSP



Sat, 02 Apr 2005 22:03:47 GMT  
 How do I create a COM wrapper for C# or Jscript.NET, so I can use it in WSH?
There are significant restrictions to using .net classes from COM/Script.
Interestingly, these are very similar to using MS Java classes (JavaMoniker)
from script, as I have occasionally posted on here before :):
  "All managed types, methods, properties, fields, and events that you want
  to expose to COM must be public. Types must have a public default constructor,
  which is the only constructor that can be invoked through COM .."

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgu...

 - Michel Gallant
    MVP Security


Quote:
> The subject appears to be coming up more frequently in the dotnet newsgroups
> lately.  I did a scan on microsoft.public.dotnet.* newsgroups via Google using
> "late bound" as a term, and got a few semi-relevant hits.

> Targeted a bit towards forms, but still explaining the general process:
> http://groups.google.com/groups?selm=OV4LlWqQCHA.4248%40tkmsftngp08


> Eric Chamberlain typed:
> > I'd like to make a COM wrapper, so I can call some of the advanced
> > EventLog features supported in the .NET framework.  Does someone have
> > detailed instructions on how to write a COM wrapper?  I have VS.NET.
> > I can compile DLLs, but when I try and use regsvr32, I get an error
> > message that the DLL can't be registered.  I suspect I don't have all
> > the code needed for a COM object.

> --
> Please respond in the newsgroup so everyone may benefit.
>  http://dev.remotenetworktechnology.com
>  ----------
>  Subscribe to Microsoft's Security Bulletins:
>  http://www.microsoft.com/technet/security/bulletin/notify.asp



Sat, 02 Apr 2005 22:20:48 GMT  
 How do I create a COM wrapper for C# or Jscript.NET, so I can use it in WSH?
You KNOW we didn't want to hear that.


Michel Gallant (MVP) typed:

Quote:
> Things work much better the other way round, i.e. using unmanaged
> typlibs with .net / C# (tlbimp.exe).
>  - Michel Gallant   MVP Security


>> I'd like to make a COM wrapper, so I can call some of the advanced
>> EventLog features supported in the .NET framework.  Does someone
>> have detailed instructions on how to write a COM wrapper?  I have
>> VS.NET.  I can compile DLLs, but when I try and use regsvr32, I get
>> an error message that the DLL can't be registered.  I suspect I
>> don't have all the code needed for a COM object.

>> --
>> Eric Chamberlain, CISSP

--
Please respond in the newsgroup so everyone may benefit.
 http://dev.remotenetworktechnology.com
 ----------
 Subscribe to Microsoft's Security Bulletins:
 http://www.microsoft.com/technet/security/bulletin/notify.asp


Sat, 02 Apr 2005 22:31:03 GMT  
 How do I create a COM wrapper for C# or Jscript.NET, so I can use it in WSH?
Mitch,

would you happen to have an example of a COM-invokable .NET class? (hint, hint).

Even a simple "Hello, World!" form would be pretty cool to see.  From prior
attempts of my own, it get the impression that it is not that much code, but
figuring out exactly how to set up everything is tough.


Michel Gallant (MVP) typed:

Quote:
> There are significant restrictions to using .net classes from
> COM/Script. Interestingly, these are very similar to using MS Java
> classes (JavaMoniker) from script, as I have occasionally posted on
>   here before :): "All managed types, methods, properties, fields,
>   and events that you want to expose to COM must be public. Types
>   must have a public default constructor, which is the only
> constructor that can be invoked through COM .."

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgu...
conexposingnetframeworkcomponentstocom.asp

Quote:

>  - Michel Gallant
>     MVP Security


>> The subject appears to be coming up more frequently in the dotnet
>> newsgroups lately.  I did a scan on microsoft.public.dotnet.*
>> newsgroups via Google using "late bound" as a term, and got a few
>> semi-relevant hits.

>> Targeted a bit towards forms, but still explaining the general
>> process:
>> http://groups.google.com/groups?selm=OV4LlWqQCHA.4248%40tkmsftngp08


>> Eric Chamberlain typed:
>>> I'd like to make a COM wrapper, so I can call some of the advanced
>>> EventLog features supported in the .NET framework.  Does someone
>>> have detailed instructions on how to write a COM wrapper?  I have
>>> VS.NET. I can compile DLLs, but when I try and use regsvr32, I get
>>> an error message that the DLL can't be registered.  I suspect I
>>> don't have all the code needed for a COM object.

>> --
>> Please respond in the newsgroup so everyone may benefit.
>>  http://dev.remotenetworktechnology.com
>>  ----------
>>  Subscribe to Microsoft's Security Bulletins:
>>  http://www.microsoft.com/technet/security/bulletin/notify.asp

--
Please respond in the newsgroup so everyone may benefit.
 http://dev.remotenetworktechnology.com
 ----------
 Subscribe to Microsoft's Security Bulletins:
 http://www.microsoft.com/technet/security/bulletin/notify.asp


Sat, 02 Apr 2005 22:53:32 GMT  
 How do I create a COM wrapper for C# or Jscript.NET, so I can use it in WSH?
Alex,
I thought you would have beaten me to the punch :)
I still don't have a large set of CDs.

Anyway, there has got to be a simple example lurking in Quick Start
or Technologies\Interop or somewhere in .net framework SDK?

If something doesn't turn up in a day or so, I'll generate an example.

Cheers,
 - Mitch
    http://home.istar.ca/~neutron


Quote:
> Mitch,

> would you happen to have an example of a COM-invokable .NET class? (hint, hint).

> Even a simple "Hello, World!" form would be pretty cool to see.  From prior
> attempts of my own, it get the impression that it is not that much code, but
> figuring out exactly how to set up everything is tough.


> Michel Gallant (MVP) typed:
> > There are significant restrictions to using .net classes from
> > COM/Script. Interestingly, these are very similar to using MS Java
> > classes (JavaMoniker) from script, as I have occasionally posted on
> >   here before :): "All managed types, methods, properties, fields,
> >   and events that you want to expose to COM must be public. Types
> >   must have a public default constructor, which is the only
> > constructor that can be invoked through COM .."

> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgu...
> conexposingnetframeworkcomponentstocom.asp

> >  - Michel Gallant
> >     MVP Security


> >> The subject appears to be coming up more frequently in the dotnet
> >> newsgroups lately.  I did a scan on microsoft.public.dotnet.*
> >> newsgroups via Google using "late bound" as a term, and got a few
> >> semi-relevant hits.

> >> Targeted a bit towards forms, but still explaining the general
> >> process:
> >> http://groups.google.com/groups?selm=OV4LlWqQCHA.4248%40tkmsftngp08


> >> Eric Chamberlain typed:
> >>> I'd like to make a COM wrapper, so I can call some of the advanced
> >>> EventLog features supported in the .NET framework.  Does someone
> >>> have detailed instructions on how to write a COM wrapper?  I have
> >>> VS.NET. I can compile DLLs, but when I try and use regsvr32, I get
> >>> an error message that the DLL can't be registered.  I suspect I
> >>> don't have all the code needed for a COM object.

> >> --
> >> Please respond in the newsgroup so everyone may benefit.
> >>  http://dev.remotenetworktechnology.com
> >>  ----------
> >>  Subscribe to Microsoft's Security Bulletins:
> >>  http://www.microsoft.com/technet/security/bulletin/notify.asp

> --
> Please respond in the newsgroup so everyone may benefit.
>  http://dev.remotenetworktechnology.com
>  ----------
>  Subscribe to Microsoft's Security Bulletins:
>  http://www.microsoft.com/technet/security/bulletin/notify.asp



Sat, 02 Apr 2005 23:06:38 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Experimental Technique: automating COM class creation with C# and VB.NET command line compilers

2. Experimental Technique: automating COM class creation with C# and VB.NET command line compilers

3. C# IEnumerator & COM interop w/ WSH

4. C# and ASP.Net

5. VB.NET "Compatibility Wrapper"

6. HELP NEEDED: ShowModalDialog ASP.NET (C#)

7. I want to send mail in WSH with JScript source...What am I doing wrong

8. I want to send mail in WSH with JScript source...What am I doing wrong

9. HOWTO: Dynamically create, run, and delete a .NET console application from WSH

10. Using VS. NET editor for creating VBScripts

11. COM Wrapper object?

12. Script problem in attempting to create a project in VS.NET using XP

 

 
Powered by phpBB® Forum Software