0

I am new to C#. I am not a good programmer but I have worked on some projects which were in Delphi7. In Delphi there is one option; compile the class files to create .dcu. Those .dcu can be used without having the actual code with any other project in Delphi and after build .dcu files need not no given to end user.

Now my actual Question,

Is there any way where I can create some compiled file from my C# class and use that compiled unit with some other project in C# ?

I already tried to create dll and use. Nice Idea, but I don't want to give any other file than Configuration File and Executable file. Since, I created dll that needs to give with application.

I also tried to create a setup of application which build executable, configuration file and dll together. while executing, it extract itself in %temp% folder and executes from there only. So, In this case I am not able to set the configuration file's values.

Again the same question,

Is there any way where I can create some compiled file from my C# class and use that compiled unit with some other project in C# ?


Please suggest the solution

Thanks

Romesh
  • 2,291
  • 3
  • 24
  • 47
  • this is one of the most duplicated questions here. I myself have closed over 5 such questions. – nawfal Oct 19 '12 at 06:41
  • nawfal,Its not duplicate question. Its slightly different from other questions. Till now I have not found the solution for this. – Romesh Oct 19 '12 at 09:03

2 Answers2

2

Make it into a .dll. And then add that .dll as a reference in whatever project you want by clicking on References and then selecting Add Reference, and then in the Browse tab navigate to your .dll and select add. You will now have access.

Travis J
  • 81,153
  • 41
  • 202
  • 273
  • Thank you for quick reply. But as I already said that, I don't want to give any other file than Configuration File and Executable file. Since, I created dll that needs to give with application. – Romesh Oct 19 '12 at 08:53
1

Basically you need to combine all your DLLs and the EXE to a single EXE? You can use ILMerge.
For more options take a look this question: Can a .NET windows application be compressed into a single .exe?

Community
  • 1
  • 1
coder_bro
  • 10,503
  • 13
  • 56
  • 88
  • In your case I assume you don't need any configuration file for picking values dynamically. In my case it is there. Since a merged exe runs from %temp% directory but configuration file is in some other directory. – Romesh Oct 19 '12 at 09:08