1

I have two projects. I want project A to contain all of the published files from Project B.

I added Project B as a reference to Project A. This gives me the exe file for Project B in Project A's output. However, all DLLs from Project B are missing within Project A, which results in the included exe file not working.

Is there any easy way to reference Project B in Project A with all of it's dependencies so when I publish project A, it contains the latest version of Project B fully runnable?

Marvin Klein
  • 1,436
  • 10
  • 33
  • Yes it is possible, are you using Visual Studio? – IvanMendoza Mar 28 '23 at 14:45
  • yes. Using latest Version of VS Community – Marvin Klein Mar 28 '23 at 15:17
  • 1
    Okay, your project B cannot give as output an exe file, I mean if you intention is to get access to the DLL's generated by Project B on A, Project B should be a Class Library Project, on this way you will get as output DLL's and this will appear on the Build of Project A when it gets built or published. https://learn.microsoft.com/en-us/dotnet/core/tutorials/library-with-visual-studio – IvanMendoza Mar 28 '23 at 15:24
  • Thanks. Putting everything into a Class Library and referencing it in Porject B fixes my issue. – Marvin Klein Mar 29 '23 at 08:45

1 Answers1

0

Although I don't quite understand why you want to refer to B's exe. But if you really need to merge dll to EXE, you can try ILMerge. For details, please refer to here.

Of course, I recommend that you try to put B into the class library and convert it into a dll file, which is referenced in project A. Such information is easy to find, so that all problems will be solved.

sssr
  • 364
  • 1
  • 6
  • I'm doing this because Project B is a seperate executable file which I want to run independetly from Project A. But I want to ship Project B with the published version of Project A – Marvin Klein Mar 29 '23 at 10:46
  • @MarvinKlein If this is the condition, ILMerge is a very useful tool for you. It can incorporate DLL into exe. You can refer here https://stackoverflow.com/a/10138100/20376806. If you think it is not detailed enough, other information about ILMerge on the Internet is also easy to obtain. – sssr Mar 30 '23 at 01:13