Interface - Descriptions for Methods/Properties

K

Kbalz

I've built an interface for my class library. When I add this dll to a
new .NET project, and create an instance of my class, I do not see the
description (like in the intellisense) for my properties and methods.


/////////////////////////////////////////////////////
// Here is my class before interface is used
/////////////////////////////////////////////////////

using System;
using System.Collections.Generic;
using System.Text;

namespace exAMPLE
{
class ex
{
/// <summary>
/// This comment shows up in .NET projects that referenced
this class
/// </summary>
public ex()
{

}

private messageString;
/// <summary>
/// This comment shows up in .NET projects when I use this
property
/// </summary>
public string MessageString
{
get { return messageString; }
set { messageString= value; }
}

/// <summary>
/// This comment shows up in .NET projects when I call this
method
/// </summary>
public string ShowMeTheMessage()
{
return "OK! " + messageString;
}
}
}

/// end class


/////////////////////////////////////////////////////
// This how my class looks now after I added the interface
/////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Text;

namespace exAMPLE
{
public interface Iex
{
/// <summary>
/// This comment does not show up in .NET or VB6
/// </summary>
string ShowMeTheMessage();
string MessageString {get; set;}
}

class ex : Iex
{
/// <summary>
/// This comment used to show up in .NET projects that
referenced this class, now that I'm using an interface, it
doesn't
/// </summary>
public ex()
{

}

private messageString;
/// <summary>
/// This comment used to show up in .NET tried to change this
property, now that I'm using an interface, it doesn't
/// </summary>
public string MessageString
{
get { return messageString; }
set { messageString= value; }
}

/// <summary>
/// This comment used to show up in .NET tried to call this
method, now that I'm using an interface, it doesn't
/// </summary>
public string ShowMeTheMessage()
{
return "OK! " + messageString;
}
}
}

/// end class

I've tried adding the comments inside of the interface class in a
variety of ways with no luck, I've also used [Description("string")]
in a few places, but can't seem to get the descriptions to show up
in .NET.. I'm also regasm'ing this dll into a tlb to be used in VB6
projects, there are no comments in there either.

I'm hoping to at least solve the .NET project descriptions. Any
suggestions?
 
L

Lasse Vågsæther Karlsen

Kbalz said:
I've built an interface for my class library. When I add this dll to a
new .NET project, and create an instance of my class, I do not see the
description (like in the intellisense) for my properties and methods.

When referencing assemblies you've made, intellisense is loaded from a
separate .xml file that has to be built when compiling that assembly.

In the project options, there is a checkbox for this, you'll find it on
the Build tab, a bit down. Enable this checkbox, and do a rebuild, and
you should have the intellisense.
 
M

Morten Wennevik [C# MVP]

Hi,

The intellisense comments (xml documentation) are not compiled into the dll.
To be able to se the comments make sure you create the xml documentation
(check the option in project properties->Build) and ship the xml file along
with the dll.

--
Happy Coding!
Morten Wennevik [C# MVP]


Kbalz said:
I've built an interface for my class library. When I add this dll to a
new .NET project, and create an instance of my class, I do not see the
description (like in the intellisense) for my properties and methods.


/////////////////////////////////////////////////////
// Here is my class before interface is used
/////////////////////////////////////////////////////

using System;
using System.Collections.Generic;
using System.Text;

namespace exAMPLE
{
class ex
{
/// <summary>
/// This comment shows up in .NET projects that referenced
this class
/// </summary>
public ex()
{

}

private messageString;
/// <summary>
/// This comment shows up in .NET projects when I use this
property
/// </summary>
public string MessageString
{
get { return messageString; }
set { messageString= value; }
}

/// <summary>
/// This comment shows up in .NET projects when I call this
method
/// </summary>
public string ShowMeTheMessage()
{
return "OK! " + messageString;
}
}
}

/// end class


/////////////////////////////////////////////////////
// This how my class looks now after I added the interface
/////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Text;

namespace exAMPLE
{
public interface Iex
{
/// <summary>
/// This comment does not show up in .NET or VB6
/// </summary>
string ShowMeTheMessage();
string MessageString {get; set;}
}

class ex : Iex
{
/// <summary>
/// This comment used to show up in .NET projects that
referenced this class, now that I'm using an interface, it
doesn't
/// </summary>
public ex()
{

}

private messageString;
/// <summary>
/// This comment used to show up in .NET tried to change this
property, now that I'm using an interface, it doesn't
/// </summary>
public string MessageString
{
get { return messageString; }
set { messageString= value; }
}

/// <summary>
/// This comment used to show up in .NET tried to call this
method, now that I'm using an interface, it doesn't
/// </summary>
public string ShowMeTheMessage()
{
return "OK! " + messageString;
}
}
}

/// end class

I've tried adding the comments inside of the interface class in a
variety of ways with no luck, I've also used [Description("string")]
in a few places, but can't seem to get the descriptions to show up
in .NET.. I'm also regasm'ing this dll into a tlb to be used in VB6
projects, there are no comments in there either.

I'm hoping to at least solve the .NET project descriptions. Any
suggestions?
 
K

Kbalz

Hi,

The intellisense comments (xml documentation) are not compiled into the dll.
 To be able to se the comments make sure you create the xml documentation
(check the option in project properties->Build) and ship the xml file along
with the dll.

--
Happy Coding!
Morten Wennevik [C# MVP]



Kbalz said:
I've built an interface for my class library. When I add this dll to a
new .NET project, and create an instance of my class, I do not see the
description (like in the intellisense) for my properties and methods.
/////////////////////////////////////////////////////
// Here is my class before interface is used
/////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Text;
namespace exAMPLE
{
    class ex
    {
        /// <summary>
        /// This comment shows up in .NET projects that referenced
this class
        /// </summary>
        public ex()
        {
        }
        private messageString;
        /// <summary>
        /// This comment shows up in .NET projects when I use this
property
       /// </summary>
        public string MessageString
        {
            get { return messageString; }
            set { messageString= value; }
        }
        /// <summary>
        /// This comment shows up in .NET projects when I call this
method
        /// </summary>
        public string ShowMeTheMessage()
        {
            return "OK! " + messageString;
        }
    }
}
/// end class
/////////////////////////////////////////////////////
// This how my class looks now after I added the interface
/////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Text;
namespace exAMPLE
{
    public interface Iex
    {
           /// <summary>
           /// This comment does not show up in .NET or VB6
           /// </summary>
           string ShowMeTheMessage();
           string MessageString {get; set;}
    }
    class ex : Iex
    {
        /// <summary>
        /// This comment used to show up in .NET projects that
referenced this class, now that I'm using an interface, it
doesn't
        /// </summary>
        public ex()
        {
        }
        private messageString;
        /// <summary>
        /// This comment used to show up in .NET tried to changethis
property, now that I'm using an interface, it doesn't
        /// </summary>
        public string MessageString
        {
            get { return messageString; }
            set { messageString= value; }
        }
        /// <summary>
        /// This comment used to show up in .NET tried to call this
method, now that I'm using an interface, it doesn't
        /// </summary>
        public string ShowMeTheMessage()
        {
            return "OK! " + messageString;
        }
    }
}
/// end class
I've tried adding the comments inside of the interface class in a
variety of ways with no luck, I've also used [Description("string")]
in a few places, but can't seem to get the descriptions to show up
in .NET.. I'm also regasm'ing this dll into a tlb to be used in VB6
projects, there are no comments in there either.
I'm hoping to at least solve the .NET project descriptions. Any
suggestions?- Hide quoted text -

- Show quoted text -

Your above suggestions worked for .NET Intellisense and obejct browser
summary notations, Thanks! But it didn't work for when I reference the
VB6 tlb version of my dll. Anything I can do there?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top