Solved

Make a C# wrapper for a managed assembly

Posted on 2013-01-20
4
349 Views
Last Modified: 2013-01-24
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.
0
Comment
Question by:townsma
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 9

Expert Comment

by:Orcbighter
ID: 38800801
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?
0
 
LVL 6

Author Comment

by:townsma
ID: 38800885
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
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 38801343
I'm not sure if there's any other way to do what you seek outside of wrapping every method you want to use from the API. The only other thing I can think to do would be to use Reflection, and there would be a performance penalty for that. You would have to judge whether or not this penalty was acceptable for your application.
0
 
LVL 9

Expert Comment

by:Orcbighter
ID: 38808743
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.
0

Featured Post

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question