Exporting DLL description - reference with Visual Studio 2012 - visual-studio-2012

I colleague of mine asked me to see a dll that he needs to use. So I used the Object Browser on Visual Studio 2012. Now he asked me if I can export like a text version of the dll reference (methods signatures and properties).
Is there a way to do it?
I can already see something like
short get_Param(short sNumParam)
Member of LMLib.ISWKey
on the windows dedicated to the description. I just need to put every method in a single file.

You can do it with a trick and have the IDE generate the definitions for you. Write a sliver of code in the text editor, similar to:
var obj = new LMLib.ISWKey();
Right-click ISWKey in the text editor and select "Go To Definition". You'll get a new text file with the definitions, auto-generated from the metadata.
If it is a COM interface, sure sounds like it with a name like that, then you can run Oleview.exe from the Visual Studio Command Prompt. Use File + View Typelib, select the type library of the COM server and you'll get the auto-generated IDL for the server. Prefer this approach if it is in fact a COM server, you'll get more info, including the [helpstring] attributes.
And of course, don't hesitate to ask the owner of the DLL for documentation. You paid good money for the license to use the DLL.

Related

Which Visual Studio project types support Shift+Alt+D to open the Data Sources window?

In Visual Studio 2012, it appears that only maybe a third of the 20 or so C# project types support using Shift+Alt+D to open the "Data Sources" window (and none that I've found ever display the mythical "Data" menu bar option).
Is there any sort of guide as to which project types will allow you to work with data sources?
Also, is there any way to "adjust" the features of a project after it's been created?
Update: See my answer below for how to add the Data Sources function to an existing project.
I believe you are looking for this page:
http://msdn.microsoft.com/en-us/library/yft2c9ad.aspx
To quote msdn: "You can add a data source to a project only if it supports creating and working with data sources. For example, you can't open the Data Sources window in a project for a Windows Store app."
Basically, if using a database seems logical in your application, you can probably use one.
To answer your question about the "mythical 'Data' menu bar option", here's how you access it:
You just have to select "View", then "Other Windows", and finally "Data Sources"
And to answer your final question about, "Also, is there any way to 'adjust' the features of a project after it's been created?"
Yes, yes there is. If you mean as a compiled executable, one could simply decompile the project or use an ILcode editor. If you mean as a solution in visual studios, using the solution explorer you can access "My Project" and simply double click that to get a nice little gui for adjusting your project.
EDIT:
For an overload of information about data in visual studios, you can visit: http://msdn.microsoft.com/en-us/library/wzabh8c4.aspx
For more information about just the data source window, you can visit:
http://msdn.microsoft.com/en-us/library/6ckyxa83.aspx
Aha! There is a way to add data access to a project that lacks it, per: http://msdn.microsoft.com/en-us/library/bb907587.aspx. To quote:
To create a class from a database table
If you are working with a Web site project, and the project does not already have an App_Code folder, in Solution Explorer, right-click the project, click Add ASP.NET Folder, and then click App_Code.
In Solution Explorer, right-click the App_Code folder (for a Web site project) or the project (for a Web application project) and then click Add New Item.
Under Installed templates, select Linq to SQL Classes template, type a name for the .dbml file, and then click Add.
-- The Object Relational Designer window is displayed. [Note that this is the window that Shift-Alt-D displays]
In Server Explorer, drag the database tables or other objects (such as views) that you want to use with LINQ to SQL into the Object Relational Designer window.
-- The tables and their columns are represented as a entities in the designer window.
Save the .dbml file.
This creates .designer.cs or .designer.vb file that is located under the .dbml file. The file contains a class that represents the database and a class that represents the table. The parameterless constructor for the database class reads the connection string from the Web.config file.
(Note that, after performing this procedure you may get a message "The type or namespace name 'Linq' does not exist in the namespace 'System.Data'". The solution to this problem is found here.)

Sandcastle, /doc, and Unmanaged C++

I work on a project that uses unmanaged visual C++ and a smattering of C#. We are trying to come up with a way to document our project, both the API reference, as well as some additional conceptual documents. Ideally, all of the documentation would live together in a .chm file that we could distribute with our product.
I was already familiar with Doxygen, as a long time C++ developer. Someone suggested that I look into Sandcastle as well, but I've run into a few snags.
From a number of other sources, including other posts on this site, it's well known that sandcastle does not support unmanaged C++. I did find a post that seems to indicate that you can still cram the C++ documentation into sandcastle, by adding the API reference as conceptual topics.
Using Visual Studio 2010, you can turn on the /doc option in the project settings for your unmanaged C++ project. This produces .XDC files which studio then compiles into an .xml file that goes along with your lib/dll/exe. Where I am stuck is that is unclear what exactly you can do with this xml file. Some pages I've found online suggest that you may be able to use this file for intellisense, but I've never seen that work in unmanaged C++. I was hopeful that I might be able to use this .xml file in Sandcastle Help File Builder somehow, but I can't find any examples of how that's done online, and every attempt I've made with SHFB has failed. It seems to only want MAML or HTML files if I want to add an existing conceptual help file.
So my question:
Is there a way to get my /doc generated .xml file into my SHFB help solution?
If not, what is the point of the /doc option for unmanaged C++?
Is there some kind of transformation I can do on my /doc generated .xml file to produce HTML or MAML which I could then import via SHFB?
Can this work, or should I just go back to Doxygen?
In theory, Sandcastle could be used to document unmanaged code but it would require a tool to produce the equivalent reflection data file that is currently produced by the MRefBuilder.exe tool for managed code assemblies. So far, nobody has done that to my knowledge.
I can't comment on the lack of IntelliSense for unmanged C++ since I don't use it anymore. At a guess, /doc is probably there for the managed code output assuming the same compiler is used but with a few extra command line options.
Using XSL to transform the XML comments to MAML is a possibility but, again, it's an option I'm not aware of anyone pursuing. My guess is that most opt to use Doxygen in this case since it's an established solution.
Eric
I have a similar situation. I need XML documentation in my C++/CLI bindings so .NET code can see them with Intellisense. But FYI, Visual Studio 2010 doesn't support XML documentation in native code:
https://msdn.microsoft.com/en-us/library/ms177226(v=vs.100).aspx
Visual Studio 2010
In Visual C++, you can add XML
documentation (triple-slash) comments to your source code and instruct
the compiler to output them to an .xml file. This file can then be
input to a process that creates documentation for the classes in your
code. The IDE for Visual C++ in this version does not support XML
comments in Intellisense.
That limitation was removed in Visual Studio 2013. However, it's still an annoying ecosystem to work with if you use templates in the native code (e.g. Boost libraries):
In the current release, code comments are not processed on templates or anything containing a template type (for example, a function taking a parameter as a template). Adding such comments will result in undefined behavior.
I found your question while searching for a way to temporarily disable the XML comment parser with a #pragma or #define when including such libraries.

ATL: Can't remove a method from a COM interface - ALWAYS reappears like magic

Environment: VS2008, C++ ATL COM, 64Bit, Windows 7
I'm trying to remove a method from an older COM interface. I modify the *.idl, modify the associated *.h and *.cpp implementation files and also remove it from the main project's .h file. I can search the whole project for the old method name - does not show and it compiles/links fine. However, if I then use the Object Browser to look at the compiled DLL - the dang method is still there! If I 'reference' the DLL in a .NET project - shows the method. If the .NET code attempts to use the method - it gets a memory exception (which makes sense). I can't for the life of me figure out how to modify the IDL, remove the method code and have the resulting compiled DLL be correct.
Where the heck is the method lurking and is there a different way to remove a method from an existing ATL generated COM interface? I'm stumped! Thanks!
Did you unregister the old DLL module and registered the new one? Sounds like your registry may have an inconsistent entry.
Also make sure there are no pre-compiled headers etc laying around so that when you compiler you are sure it hasn't included some old copy.
probably best is to delete the complete build directory (debug/release) before compiling just in case you missed deleting some old files.
check also the path where the .dll is loaded, you can see that in the object browser, compare that with the registry entry. maybe you did a 32bit version before?

Add Custom WPFControls to toolbox automatically

I am trying to add a WPF control to the toolbox in VS 2010. I tried setting the ToolboxAutopopulate.This works only within the project. But i want the control to appear every time i open the VS irrespective of the project.
I tried making an entry into the RegEdit after deleting the tdb fils. It somehow doesn't appear in the toolbox still. Can somehow help me?? I don't know what i am missing. If someone wants to know more details i can provide.
The steps i followed were:
Close all running Visual Studio 2008 instances.
Delete *.tbd file located in your \Local\Microsoft\VisualStudio\9.0 folder (for example: C:\Users\\AppData\Local\Microsoft\VisualStudio\9.0 in Vista or 7).
Add a new key to:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\ToolboxControlsInstaller
or on x64 OS
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0\ToolboxControlsInstaller
The key is named like "QLeftPanel, Version=3.5.30729.1, Culture=neutral, PublicKeyToken=cd45d629e1d8d371", where you replace the WpfCustCtrl and PK token value with your own.
In the key created in step 3, add the following values:
(Default) = "My WPF Controls" This is the toolbox tab name, String
CodeBase = "C:\Users\Aneesh\Documents\Visual Studio 2010\Projects\QSharedLibrary\QSharedLibrary\bin\Debug\QSharedLibrary.dll" This is the path to your control assembly.
WPFControls = "1" This is important!
Try installing your control's design.dll and visualstudio.design.dll into GAC. then, take a backup of your existing tbd and delete the existing. Now, launch the Visual Studio, it will create the new tbd files. Now, It should load.

What information about me and my system do compilers add to executeables?

I'm currently using Microsoft Visual Studio 2010.
If we say that we give 10 different people a copy of MSVC 10 and a short C++ Hello, World listing. They all create a new project using exactly the same settings, add a new cpp file with the Hello, World program and compile it.
Do they all get the exactly same binary?
If not, what are the exact differences?
What information about my system does MSVC add to my executeable?
Paranoia!
If you each create a project from scratch you'll at least get different GUIDs assuming it's the type of project that needs GUIDs. The GUID is set at the time you create the project so if one of you creates the project and then you share the project there will be no difference in the binaries. There is no identifiable info in the GUIDs AFAIK.
Just can't help to respond even though the question is more than a year old.
Apart from what was already mentioned (source paths & guid), there is also a structure present in most Portable Executable file known as the Rich Header.
More detailed info can be found at the following links:
http://ntcore.com/files/richsign.htm
http://web17.webbpro.de/index.php?page=microsofts-rich-header
As far as I know you would get the exact same binary...

Resources