sw3103 / movemouse

Move Mouse is a simple piece of software that is designed to simulate user activity.
http://www.movemouse.co.uk/
GNU General Public License v3.0
573 stars 108 forks source link

How to compile source as standalone exe? #79

Open stamminator opened 1 week ago

stamminator commented 1 week ago

Your GitHub releases are packages as a standalone executable, which is great. I haven't been able to figure out how to do the same. Could you share how you accomplish that?

sw3103 commented 1 week ago

Hi @stamminator,

What issues are you having? Any specific error messages?

stamminator commented 1 week ago

@sw3103 No error messages. All I'm doing is running a build in release configuration, which produces all the dependencies as standalone files alongside a small executable in the bin directory, whereas yours is just one large executable.

sw3103 commented 1 week ago

Ah, now I understand what you're asking.

I have added a reference to this package which accomplishes this for me.

https://github.com/Fody/Fody

sw3103 commented 4 days ago

@stamminator any luck?

stamminator commented 3 days ago

I see the Nuget reference to Fody, but I still don't know how to use it. It looks like the Costura add-in is where the packaging into a single exe happens, but since the FodyWeavers.xml file looks like this...

<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
  <Costura/>
</Weavers>

... it's not clear how that's being accomplished. Are there additional steps or configuration beyond running a Release build in Visual Studio 2022 that you're doing to make this work?

sw3103 commented 17 hours ago

It really is as simple as that. Here is Move Mouse's FodyWeavers.xml:

https://github.com/sw3103/movemouse/blob/master/4x/Move%20Mouse/FodyWeavers.xml

Once you compile you should be able to test by copying the single exe into a new directory without any of the dependencies and validate it runs. Don't be confused by the fact that the Fody component doesn't clean-up the dependencies from the bin folder.