-1

I have my WindowsFormsApp programmed in c# in visual studio. It is running perfectly on my windows machine.

I included some of the nuget packages(like Renci.SshNet) installed and used while writing the code and it runs perfectly from Visual Studio but when i run the exe from another windows machine, it isn't running.

So i copied the dll(of Renci.SshNet) to the other windows machine to the same folder containing my .exe file and tried running again. This time i can run successfully.

But is there a solution to pack the dll along the .exe and generate a standalone executable that can run on other windows machine without copying the dll everytime?

Note: It does not need to be independent from the .NET framework. I assume that anyone using this exe will have that installed.

It would be great if someone helps me finding solution for this problem and thanks in advance.

Stephen Kennedy
  • 20,585
  • 22
  • 95
  • 108
jenny
  • 500
  • 7
  • 22

1 Answers1

1

You can install a nuget package called Fody

Install-Package Fody -Version 5.1.1

After it is installed, whevener you build your program, all referenced DLLs will be merged with the exe. Check the .net framework version before installing because on top of my head I remember that the current version only works with .net framework 4.6 and later.

Jack Le
  • 353
  • 2
  • 9