0

I have a class library project that is referencing .Net Framework 4.7.2 . I need to create an exe which will contain all the references of the project. I will not have access to any code or project references on the VM, where this exe needs to be run. Everything should be included in this one exe.

I have come across this question on SO.

Are solutions such as costura.Fody and ILMerge mentioned in that question addresses the same issue that I have?

( I am new to .Net and C#) and I was in doubt because I am not sure of managed assemblies vs. any other as mentioned in one of the answer in question that I referenced

Can someone help in clearing this or suggesting any other solution, if there is any.

user1207289
  • 3,060
  • 6
  • 30
  • 66
  • I don't think the .NET compiler can produce a single executable file with everything for .NET Framework applications, only .NET Core I believe. So yes, I would assume you need a 3rd party tool. – Lasse V. Karlsen Jan 29 '20 at 17:09
  • to echo that: this is pretty easy in .NET Core, but *incredibly* hard on .NET Framework; there *are tools for this* on .NET Framework, but they are all somewhat ... awkward, and hard to advise casually – Marc Gravell Jan 29 '20 at 17:19
  • So `costura.Fody` and `ILMerge` are only for .NET core? What are those tools that you mentioned above for .NET Framework? – user1207289 Jan 29 '20 at 17:25
  • ILMerge, ILRepack for sure works with .NET Framework, but they pack a references to NuGets and other project references. As I know (I can be wrong) they don't pack assemblies from .NET Framework, so still you will need .NET Framework 4.7.2 on target machine. It looks different in .NET Core - there everything is a NuGet, so probably it's easier to merge assemblies. Move forward - from .NET Core 3 there is a build in feature to create one output file with all dependencies. – Lukasz Szczygielek Jan 29 '20 at 17:52

1 Answers1

1

Costura.fody worked pretty much out of the box for .net 4.7.2 framework. When executable was compiled it included everything. One way to know is that the size of your executable will increase . The other way is to use tool like ILSpy to look inside executable

user1207289
  • 3,060
  • 6
  • 30
  • 66