HighTechTalks DotNet Forums  

howto generate a helpstring in typelib from interop assembly?

Dotnet Framework (Interop) microsoft.public.dotnet.framework.interop


Discuss howto generate a helpstring in typelib from interop assembly? in the Dotnet Framework (Interop) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
=?Utf-8?B?bGl0dGxlIHdpenphcmQ=?=
 
Posts: n/a

Default howto generate a helpstring in typelib from interop assembly? - 07-30-2007 , 04:20 AM






hello,

I have created an interop assembly in C#.
But I couldn't find any way to export helpstrings to the generated typelib
for this assembly.
Which ways have I to do this?

Thanks for your time and any suggestions.

Best regards
Detlev

Reply With Quote
  #2  
Old   
Jialiang Ge [MSFT]
 
Posts: n/a

Default Re: howto generate a helpstring in typelib from interop assembly? - 07-30-2007 , 09:41 PM






Hello,

From your post, my understanding on this issue is that you are to export
helpstrings to the typelib generated from an interop assembly in C#. If I'm
off base, please feel free to let me know.

To export helpstrings to tlb, you may consider setting the attribute:
[System.ComponentModel.Description("just for test helpstrings")]
for the methods exposed.

Here is my test code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Runtime.InteropServices;

[assembly: Guid("efe72271-546a-4095-ba7a-b1a64264e1cb")]
[assembly: AssemblyVersion("1.0.0.0")]

namespace NETAssembly
{
[InterfaceType(ComInterfaceType.InterfaceIsDual), ComVisible(true)]
public interface ITest
{
[System.ComponentModel.Description("just for test helpstrings")]
string HelloWorld();
}
[ClassInterface(ClassInterfaceType.None), ComVisible(true)]
public class TestClass : ITest
{
public string HelloWorld()
{
return "Hello World!";
}
}
}

1. Save the above code into a cs file (*****.cs)
2. Run ¡°csc /t:library *****.cs /keyfile:key.snk in .net 2.0 SDK cmd line.
3. Run tlbexp *****.dll /oututfile.tlb to get the tlb file.

Please let me know if you have any other concerns, or need anything else.

Have a nice day!

Sincerely,
Jialiang Ge (jialge (AT) online (DOT) microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

With newsgroups, MSDN subscribers enjoy unlimited, free support as opposed
to the limited number of phone-based technical support incidents. Complex
issues or server-down situations are not recommended for the newsgroups.
Issues of this nature are best handled working with a Microsoft Support
Engineer using one of your phone-based incidents.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


Reply With Quote
  #3  
Old   
=?Utf-8?B?bGl0dGxlIHdpenphcmQ=?=
 
Posts: n/a

Default Re: howto generate a helpstring in typelib from interop assembly? - 07-31-2007 , 04:54 AM



Hello Jialiang Ge,

thanks for your advice.
U have understand my post right.
That sample works.
But my interface definition includes properties, and I want to have for the
propget and propput method in the typelib different helpstrings.

I add my code to your test code to explain my intention:
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Runtime.InteropServices;

[assembly: Guid("efe72271-546a-4095-ba7a-b1a64264e1cb")]
[assembly: AssemblyVersion("1.0.0.0")]

namespace NETAssembly
{
[InterfaceType(ComInterfaceType.InterfaceIsDual), ComVisible(true)]
public interface ITest
{
[System.ComponentModel.Description("just for test helpstrings")]
string HelloWorld();

string MyTestProp
{
[System.ComponentModel.Description("MyTestProp get")] // in
typelib will this eported for both, get and set
get;
[System.ComponentModel.Description("MyTestProp set")] //
this won’t be exported to the typelib
set;
}
}
[ClassInterface(ClassInterfaceType.None), ComVisible(true)]
public class TestClass : ITest
{
public string HelloWorld()
{
return "Hello World!";
}

public string MyTestProp
{
get
{
return m_MyTestProp;
}
set
{
m_MyTestProp = value;
}
}

private
string m_MyTestProp = "";
}
}
My question is how can I export the helpstring for the set (propset) method?
Thanks for your time and help.

Best regards
Detlev

"Jialiang Ge [MSFT]" wrote:

Quote:
Hello,

From your post, my understanding on this issue is that you are to export
helpstrings to the typelib generated from an interop assembly in C#. If I'm
off base, please feel free to let me know.

To export helpstrings to tlb, you may consider setting the attribute:
[System.ComponentModel.Description("just for test helpstrings")]
for the methods exposed.

Here is my test code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Runtime.InteropServices;

[assembly: Guid("efe72271-546a-4095-ba7a-b1a64264e1cb")]
[assembly: AssemblyVersion("1.0.0.0")]

namespace NETAssembly
{
[InterfaceType(ComInterfaceType.InterfaceIsDual), ComVisible(true)]
public interface ITest
{
[System.ComponentModel.Description("just for test helpstrings")]
string HelloWorld();
}
[ClassInterface(ClassInterfaceType.None), ComVisible(true)]
public class TestClass : ITest
{
public string HelloWorld()
{
return "Hello World!";
}
}
}

1. Save the above code into a cs file (*****.cs)
2. Run ¡°csc /t:library *****.cs /keyfile:key.snk in .net 2.0 SDK cmd line.
3. Run tlbexp *****.dll /oututfile.tlb to get the tlb file.

Please let me know if you have any other concerns, or need anything else.

Have a nice day!

Sincerely,
Jialiang Ge (jialge (AT) online (DOT) microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

With newsgroups, MSDN subscribers enjoy unlimited, free support as opposed
to the limited number of phone-based technical support incidents. Complex
issues or server-down situations are not recommended for the newsgroups.
Issues of this nature are best handled working with a Microsoft Support
Engineer using one of your phone-based incidents.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.



Reply With Quote
  #4  
Old   
=?Utf-8?B?bGl0dGxlIHdpenphcmQ=?=
 
Posts: n/a

Default Re: howto generate a helpstring in typelib from interop assembly? - 07-31-2007 , 06:14 AM



Hello Mathias,

thanks for your advice.
I've concretize my problem in my reply to "Jialiang Ge".

Best regards
Detlev

"Mattias Sjögren" wrote:

Quote:
Which ways have I to do this?

Use the DescriptionAttribute and AssemblyDescriptionAttribute classes.


Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.


Reply With Quote
  #5  
Old   
Jialiang Ge [MSFT]
 
Posts: n/a

Default Re: howto generate a helpstring in typelib from interop assembly? - 07-31-2007 , 08:42 AM



Hello

I don't think Property's helpstring can be divided: one for propget,
another for propput.
If you see the VB Properties through object brower, you will find them have
only one helpstring.
For instance: the helpstring of Form's property 'Appearance' is:
Property Appearance As Integer
Member of Unknown1._Form
Returns/sets whether or not an object is painted at run time with 3-D
effects.

Therefore, I suggest that you write 'Returns/sets ...' as description of
property if it has both set and get methods.

Mathias, any idea?

Sincerely,
Jialiang Ge (jialge (AT) online (DOT) microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.




Reply With Quote
  #6  
Old   
=?Utf-8?B?bGl0dGxlIHdpenphcmQ=?=
 
Posts: n/a

Default Re: howto generate a helpstring in typelib from interop assembly? - 07-31-2007 , 10:32 AM



Hello,

many thanks for your fast and qualified advise.
I will use this in that way.

Best regards
Detlev

"Jialiang Ge [MSFT]" wrote:

Quote:
Hello

I don't think Property's helpstring can be divided: one for propget,
another for propput.
If you see the VB Properties through object brower, you will find them have
only one helpstring.
For instance: the helpstring of Form's property 'Appearance' is:
Property Appearance As Integer
Member of Unknown1._Form
Returns/sets whether or not an object is painted at run time with 3-D
effects.

Therefore, I suggest that you write 'Returns/sets ...' as description of
property if it has both set and get methods.

Mathias, any idea?

Sincerely,
Jialiang Ge (jialge (AT) online (DOT) microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.





Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.