Link to home
Start Free TrialLog in
Avatar of townsma
townsmaFlag for Indonesia

asked on

Make a C# wrapper for a managed assembly

Before I begin, let me start my saying, I understand what I am asking for is very unusual
and not normally required.

I have a serial of assemblies, six in total.  The are true .Net assemblies. They are actually the Red-gate SQL Compare SDK  assemblies.

I have a license to use these, however, the license only allows me to build against them on one machine.  I actually have three computers which I use on a regular basis, and more than once have needed to recompile my app to fix a bug on a machine that does not have the license installed.

My solution to this, is, I wish to make a wrapper dll, that will allow me to have all the functionality of the original dlls.  I could then build this against the correct licence then use this dll as is, on all my computers, with the need to recompile it.

The Red-gate website actually suggest this as an option to prevent constant re-licensing.

My question is, as these assemblies have many classes, methods, enums, etc. is there a simple way to make this wrapper, without having to manually map every class, method, function, enum etc.

I know with COM+ I can use the .Net import tools, but I have never seen a tool to import a .Net assembly.

Any and all help is greatly appreciated.
Avatar of Orcbighter
Orcbighter
Flag of Australia image

To simplify your problem:
You have a PC AAA on which is installed the Red-gate licence.
You have software that runs on three machines: AAA, BBB, and CCC
There is a bug in your software on BBB and you would like to rebuild your app on BBB.
1. Are you unable to replicate the bug on AAA, do the code-fix and then rebuild and then reship the software to BBB?

To proceed with your request implies that you will make a fix on BBB and rebuild on BBB, allowing the software on BBB to diverge from that on AAA and CCC. Is this correct?
Avatar of townsma

ASKER

The purpose of the different machines is simple, I have a desktop in my office, I have a desktop at home and I have a laptop for when travelling.  All computers have VS2010 installed, along with the source code of my app.  But only the system at the office has the redgate sdk tools installed.  The other two computers have the redgate runtime files only.

If I need to do an urgent hot fix I may be at home, or I may be on a different customers site.  Either way I need to build the app again.  Because the redgate sdk is only on the office system, the build will fail.

So RedGates solution is to make a dll, that acts as a wrapper to their assemblies, this will be compiled on the office system, and the license will be embedded in the dll.  This built dll, along with it's dependent files, can then be copied to any other computer, and used in my app.

As the dll itself will not be rebuilding, the build of my app will succeed.

I hope this explains it better.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I agree, there seems no way to avoid making your own DLL with stubs for the APIs.
One good point is that the your dll only has to provide wrappers for those parts of the API that you actually used, not the entire Red-gate API.