I’m using ILMerge to combine a .dll and my .exe program into 1 .exe.
When I downloaded ILMerge, the application was in a folder called net452, so I assume this program was built using .NET 4.5.2
Since I’m using ILMerge to output a .exe for me, must my application also be written in .NET 4.5.2? I tried ILMerge with my program written in the latest .NET version (4.7.2) and it worked. I wonder if this was a coincidence.
However, when I try to build my program using .NET 4.5.2, I get all kinds of errors when running the my program. Most errors say “Exception thrown: ‘System.Security.Authentication.AuthenticationException’ in System.dll”.
So 2 questions:
-
Can I use ILMerge (which specifies it was written in .NET 4.5.2) with my .NET 4.7.2 program?
-
Why is my program throwing errors when I try to build with .NET 4.5.2? I’m using Visual Studio Community 2019
Yes
I’m not sure but my guess is the library you’re using was compiled for a higher version of .net framework
Also you should look into .net core or .net 5. That has an option to publish your program as a single file without any additional libraries.
I downloaded the 4.5.2 SDK but still no change. It’s just the standard system library and htmlagilitypack.
I’d rather use .net framework because .net core does not come with Windows.