Is there a tool like Reflector for COM libraries? - com

Is there a tool like Reflector for COM libraries? I would like to open a COM library and browse the classes and interfaces just like in Reflector. I would rather not install Visual Basic 6.0 in order to do this, if possible.

Not in the same way however there are number of tools that allow you to examine the type library. For example OleView.
You can also get a good idea of the types inside COM library by simply adding it to a .NET project. You can then use object browser to browser the resulting interop assembly or even use Reflector on the assembly.

Even though normal reason for this tool is doing security assessment for COM objects you can still try ComRaider - http://labs.idefense.com/software/fuzzing.php#more_comraider
It's similar to Oleview.

Related

Platform-specific dependencies of portable class libraries

I have a piece of code that compiles for both the Silverlight and the .NET targets. It depends on Json.NET and SharpZipLib. My goal is to make a portable library that Silverlight and .NET projects can both link against.
Since there is no version of SharpZipLib targeting "portable-net40+sl50", I have a problem.
However, if I knew how, I would be willing to write the wrapper code myself.
So: How can I write a portable library that depends on Silverlight's SharpZipLib when being linked against from Silverlight and depends on .NET's SharpZipLib when being linked against from .NET?
Is that at all possible or is that something only Microsoft can do?
If your code uses a limited sub-set of the SharpZipLib API, you could create a "dummy" PCL library comprising this API subset, but without any functionality implemented.
What you then must do is to change the strong name (assembly name and signing) and version of the existing .NET and Silverlight SharpZipLib:s to be the same as your "dummy" PCL SharpZipLib and re-compile the platform specific libraries as well.
With this set of assemblies (PCL, .NET and Silverlight) you will now be able to consume the PCL library from other PCL libraries. In a platform specific application that makes use of PCL libraries that in turn consumes the SharpZipLib library, you should explicitly reference the platform specific SharpZipLib library that has the same strong name and version as the PCL analogue.
You should find more about this technique ("bait-and-switch") here and here. The PCL Storage project is also a good example of where this technique has been applied.

MPXJ library with VB6 , is it possible?

I'm trying to communicate my application VB6 (et VBA) with MS Project 2007 so I would like to use the MPXJ library. The problem is that I dont know if it's possible to use these .net libraries with my VB6 application. I cant add the .dll directly
How could I do this, ideas? I can't migrate my code to vb.net
thanks
I'm pleased to say that MPXJ can be used via COM. You'll need to download version 4.5.0 from SourceForge. In the lib.net directory you'll find the DLLs and TLBs you'll need. You will need to use regasm to register the assemblies for use with COM. There are some brief notes here on working with MPXJ via COM.
You may find the notes here useful as they discuss the three different flavours of mpxj.dll that are shipped, and MPXJ's dependencies.
I'd be happy to update the documentation on working with MPXJ via COM in the light of your experience!

VB6 compile against side-by-side assembly

I have a DLL written in C# and set for COM visibility. I have it setup as a side-by-side assembly and can successfully deploy the application to client PCs registration free. My question is related to the development PC. Is it possible to compile against the DLL in a similar registration-free manner or is registration required on the development machine? I have tried adding the DLL directly though the Project -> References menu and get an error stating "Can't add a reference to the specific file." The DLL is sitting in the same directory as the .vbp file and I have tried adding the DLL both with and without the client app manifest being present.
I have tried adding the DLL directly though the Project -> References menu
That adds a reference to a type library. A type library is a language-independent description of the types in a COM component, VB6 uses it to know how generate efficient code and to provide type checking and auto-completion. A type library is the exact equivalent of metadata in a .NET assembly.
Traditionally, and the way VB6 did it, the type library was embedded as a resource in a DLL. So you are probably used to picking a DLL in the dialog. That however doesn't work so well when the DLL is generated by C#, the type library can only be generated after the C# code is compiled. You have to pick the .tlb file in the VB6 dialog. The traditional way starts with the COM component being described in the IDL language, the type library can be generated before the code is compiled so can easily be embedded in the final DLL. It is technically possible to do it in C# as well, but the build steps are very laborious and painful, you essentially have to build the DLL twice with different build commands.
The type library for a C# library is normally generated in one of three ways:
Using Project + Properties, Build tab, "Register for COM interop" option. This requires VS to run elevated so it can write to the registry. You start VS elevated by right-clicking its shortcut and picking "Run as Administrator"
By running Regasm.exe, using the /tlb:filename option. An alternative for the 1st bullet and necessary if you don't want to run VS elevated for some reason. Using the /codebase option on your dev machine is also wise to make it work exactly like the 1st bullet and not require putting the DLL into the GAC with gacutil.exe
By running the Tlbexp.exe utility, the type library exporter for .NET assemblies. No registration is done, it only generates the .tlb file.
The first bullet is the normal choice and very desirable because you can never forget to update the type library this way. It is perfectly fine on a dev machine since you only really care about reg-free deployment on the user's machine. You probably got into trouble by not doing this anymore.
Using the 3rd choice is okay and more compatible with your goals, run Tlbexp from the Visual Studio Command Prompt. Just keep in mind that you have to do it again when you make changes to your C# code. Forgetting this once and losing clumps of head-hair trying to figure out why your C# changes don't seem to be effective or getting hard-to-diagnose error codes gives you lots of reasons to consider the 1st bullet again :) You can emulate the reg-free scenario by running Regasm.exe with the /uninstall option.

Can I package and utilize a dll with an MFC ActiveX Control Object?

I've been able to create a signed CAB file for web deployment containing my control and dll, but my control seems unable to access classes and functions in my dll even though it is listed as a dependency in the CAB's inf file. For all my research, I can't even tell if what I'm trying to do is "allowed". Followup: if it is possible to talk to a non-com dll, is it a security risk?
I'm using msvc 2010. Thanks for your time!
Pretty certain what I was trying to do wasn't possible. Ended up creating a class library instead so that I could reference and include the functions I needed at compile time.

How to Compile a c++ program using .NET Framework libraries

i want comile a my c++ program using .NETFRAMEWORK libraries only at command prompt.how can i do this ??
Download the free Visual C++ Express tools from Microsoft and use the C++/CLI language (based on C++ but allows access to the whole .Net Framework) and go from there.
Basically, you're talking about Visual C++. As for using the command prompt, once you have a working program you should just be able to use something like:
cl MyProgram.cs /clr
with any other relevant options, and be up and running. If that doesn't help, give a more specific question.