Alix
Alix

Reputation: 925

An equivalent of -javaagent in C#? Or: ways to use a java framework in C#

The issue: I'm translating a system from Java to C#, and they use a java framework that I'd really like to use, since it takes care of the most complex parts of the system, which I would otherwise have to implement myself. I have the source code of this framework.

So far, I've thought of using IKVM.NET to generate a .dll, but I'm not sure what to do next, because in Java, in order to run the framework with your code, you're supposed to use the option -javaagent by adding -javaagent:bin/deuceAgent.jar (where deuceAgent is the framework) to your java command line.

I don't know what the equivalent in C# would be once I have my .dll, or whether there's an equivalent at all.

How do I do this?

Upvotes: 1

Views: 768

Answers (1)

Jigar Pandya
Jigar Pandya

Reputation: 5987

Once the DLL is created, you can add that DLL as a reference in your project and use it.

To add a reference in a Visual C# Project, you can do the following:

  1. In Solution Explorer, right-click the project node and click Add Reference.
  2. In the Add Reference dialog box, select the tab indicating the type of component you want to reference. (In your case, it is the DLL file)
  3. Select the components you want to reference, and then click OK.

enter image description here

After that, you can use the same in your coding. You may need to import namespaces that are there in the Java Class lib, and then you can use those classes.

Upvotes: -1

Related Questions