0

I have a system that downloads a file from my webserver as a .DLL. I would like to execute said DLL as an EXE file. Is there a way to start it directly as an EXE in C# or should I change it to an EXE and then run it.

EDIT: I am running Windows 10

morsotom
  • 19
  • 2
  • 2
    https://stackoverflow.com/questions/36516848/how-to-run-a-net-core-dll – Andriy Shevchenko Oct 28 '21 at 15:36
  • 1
    Do you have any idea what a dll (dynamic link library) is? – Aldert Oct 28 '21 at 15:52
  • 2
    Does your DLL have an entry point? Like a `Main()` ? – H H Oct 28 '21 at 15:53
  • My DLL is not actually a DLL; It does not have an entry point. The file is simply changed to a DLL for the streaming process. – morsotom Oct 28 '21 at 15:58
  • 1
    @morsotom: Sorry, but your explanation makes no sense. If it's not actually a DLL (but an EXE file with its extension renamed), that would mean that it *does* have an entry point. – Heinzi Oct 28 '21 at 16:14
  • Does the answer to this question solve your problem? https://stackoverflow.com/q/3434799/87698 – Heinzi Oct 28 '21 at 16:17
  • If you set `ProcessStartInfo.UseShellExecute` to false, the name/extension of your executable shouldn't matter. – Steeeve Oct 28 '21 at 16:38

1 Answers1

0

solved it with this:
File.Move(DestinationPath, Path.ChangeExtension(DestinationPath, ".exe"));

morsotom
  • 19
  • 2
  • Not what I was originally going for but it works. – morsotom Oct 28 '21 at 16:06
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Milad Dastan Zand Oct 28 '21 at 16:08