I want to add help/documentation text to a library that I am building in C#. I am using /// to create the tags and this works just fine when I use methods of my library in my lirary proyect. For example:
if my library have 2 classes Car and Person, if a I type in Person
Car.StartEngi
the auto complete of VS will suggest to use StartEngine methos and I will see the summary that for the method, fro example "This method will start the engine of the car".
But the issue comes when I compile and try to reference the dll on a separate solution. In the new solution I have already add the corresponding reference and using statement but when I write
Car.StartEngi
VS will indeed recommend to use StartEngine BUT I can not see the documentation. Does anyone know why? Do I need to add some parameter when I build the library?
P.D All the methods in the library that generates the dll are public
On the Build page of your project settings you need to turn on "XML documentation file". If you copy the XML documentation file along with your assembly then you should be able to see the documentation in other projects.
Related
I am new at C#. I am creating a project that contains two solutions and I cannot reference one from the other. I need to use the classes that are in the AssestManagment to ManejoDeActivos. Is it possible to reference based on the screenshot below?
Reference other Solution
Technically, the project "ManejoDeActivos" is to have only the front end of the applicaction. It has the GUI. The AssestManagment project connects to a database, which will allow to add information to the DB. Inside the "ManejoDeActivos" we have a GUI that allow to add a new asset through a form. I having problems calling the Assest class that will allow to create a new object of an asset. I tried to add AssestManagment to ManejoDeActivos, however when I go to references I do not see the AssestManagment project and if I tried to browse it in my computer the project solution is not showing up
You could take the code needed from one of the solutions/projects, put it into a class library project, and compile it into a DLL. You can then reference that DLL inside of another project and access the code.
I would suggest reading How To Ask to learn how to ask a question properly.
Simplest approach will be to reference all the projects of the old solution on the new solution.
It might be cumbersome as the number of projects increase but would accomplish what I’m thinking you’re trying to accomplish.
I have a C# DLL that is being used as a class to contain a list of properties about a file.
The C# DLL is COM visible, and is able to be declared and instantiated in VB6.
Inside my vb6 function where I create the object..
Dim fileObj As New MyCSharpClass.FileProperties
I am immediately able to see all the different properties accessible to my C# FileProperties object.
fileObj.(intellisense) shows me the dropdown list of anything available inside the object
But when I pass my object to a function..
GetProperties(fileObj)
When I am inside GetProperties
Public Function GetProperties(ByRef pfileObj As MyCSharpClass.FileProperties)
When I try to have intellisense show me what options are available to me..
it does now recognize pfileObj as a variable I can use, it will not show up in intellisense
If I try to manually type it out, once again intellisense will not show me any options.
pfileObj.
Is there a special way to pass COM interropt objects around to functions they were not delcared in inside of VB6?
Is this simply not possible?
I was trying to avoid creating functions that return strings, and then assign to the object properties one at a time.
The reason is because you need to have .NET create a TypeLib file which you can then reference from VB6. VB6 will use this to display intellisense as well as assist VB6 in how to invoke your C# object. You need to do the following items:
Declare an interface in C# which will publicly expose the properties/methods that you want VB6 to access.
Implement the interface in your C# object using the colon character after your class name.
Create a strong name for your project using the Strong name command line utility. (You can do this in the project properties in Visual Studio .NET).
Use the command line utility regasm.exe to create the necessary TypeLib file.
Use gacutil to add your newly created tlb file to the GAC.
Create a reference to the newly create .tlb file from VB6 (Project > References).
You can find the detailed instructions here: http://www.codeproject.com/Articles/3511/Exposing-NET-Components-to-COM. The article may be old but for the most part it is still applicable to the modern versions of Visual Studio.
I need a list of the methods and properties exposed by a COM object. I am able to late bind the object and use some basic methods that I found in an example code snippet but I need to find out the full list of methods and properties on the object.
More info:
I am trying to pull data from a fairly old system and am unable to early bind any of the dlls.
I do have some snippets of example code from the company that creates these dlls (it was packaged with the software), however it does not have code for all of the advanced functionality I am seeing from their example application (which I do not have source code to).
I have already tried using reflection without much success.
Assuming that you don't need to programatically access the information, the easiest way is to the OLE-COM object viewer. The tool is part of the Windows SDK.
Once running, look in the Type Library node and locate the type library of the component that you are using. The Type Library viewer will show you all of the dispatch interfaces defined by the component.
If you can't add the DLL to VB6 in the References dialogue, then there is no Type Library resource embedded in the DLL. If you can load the DLL, you should be able to use F2 to bring up Object Browser, and see all of the properties and methods of the component.
It seems unlikely that you hadn't tried this. So there are three possibilities:
There is an external type library for the component.
You got an error when adding the DLL as a reference, which essentially said the VB IDE couldn't find a type library in the component.
You got an error when adding the DLL as a reference, saying something like "Could not load DLL".
Just in case of 1. - check if there is a TLB or OLB file for this component.
If you got the error in 2. - then you are out of luck. You will require access to documentation and/source code.
If you got the error in 3. - then there is probably a dependent library which has not been registered. Try to find the dependent TLB or DLL, and register it.
I'm trying to write some documentation for a webservice that has been provided by one of our vendors for an application we're integrating. A bunch of the interface is custom objects defined in the web service itself. The vendor has put up significant resistance to providing any documentation for this application and so I've taken it upon myself to do their job for them [against my better judgement].
The documentation they have provided frankly is embarassing and I'm trying to make as short work of this as I possibly can to put some good quality docs together. I know that as I don't have access to their source, I can't just run it through nDoc/Sandcastle to spit out an API doc, but I was wondering if (as a half way house) there was an easy way to export the intellisense to a text file without me having to write a utility to specificially iterate through each of the object types defined and reflect the members out to text?
If I could do this, it would at least make sure that I have a good quality document structure where I can just fill in the blanks. Having to skip back and forth to Visual Studio to check the intellisense for every class member is a very laborious way of doing this.
Does anyone have any ideas?
If it is a web service that you are trying to document, couldnt you then parse out the WSDL?
If you are accessing a remote Web Service, then I think you have access to the corresponding WSDL: what about parsing it and look for just the information you need?
Or using a tool to do this (I Googled for "wsdl documentation generator")?
Or even using WSDL.exe to generate some dummy code from the WSDL and then document it, perhaps helped by GhostDoc?
HTH
Could you use Reflection to dump out the methods etc.?
Reflection is the feature in .Net, which enables us to get some information about object in runtime. That information contains data of the class. Also it can get the names of the methods that are inside the class and constructors of that object.
I think VS.net generates documentation for intellisense. For existing assemblies, it is already on your file system (e.g. C:\Windows\Microsoft.NET\Framework\v2.0.50727\en)
Try using the assembly from the vendor in VS.NET. Use process explorer or any such tool from sysinternals to see what files are being loaded. I am sure, you will find that there is an xml file created for the custom assembly (which is used to show the Intellisense and documentation available with it).
Hope that helps.
EDIT: I think the same folder (where your custom assemblies are located) will have the xml files for documentation.
If you have the dll's could you not decompile them and then recompile and use nDoc? That should give you a reasonalbe start.
Could you just use reflector (from redgate) to view the assembly (decompiled) instead of reproducing a API document. I'm not sure what else you would get of reflecting and building your on document that you wouldn't see live in reflector (of course this would depend on their writing readable code.
Maybe this is crazy, but could you take a screenshot of the full listing, and run it through an OCR program?
Is there a quick & dirty way of obtaining a list of all the classes within a Visual Studio 2008 (c#) project? There are quite a lot of them and Im just lazy enough not to want to do it manually.
If you open the "Class View" dialogue (View -> Class View or Ctrl+W, C) you can get a list of all of the classes in your project which you can then select and copy to the clipboard. The copy will send the fully qualified (i.e. with complete namespace) names of all classes that you have selected.
Maybe you can write an XSL/XSLT to display only the class names from the XML generated by the XML documentation, if you have any.
I would probably build the assembly, and then use reflection to iterate over all the exported types... If you want some sample code you can find inspiration in http://www.timvw.be/presenting-assemblytypepicker/.
I've had success using doxygen to generate documentation from the XML comments in my projects - a byproduct of this is a nice, hyperlinked list of classes.