I noticed that I can add a reference not only to a DLL but also to an EXE in Visual Studio and access all classes in the EXE as it if were a DLL.
Is there any reason to create a DLL or can I just as well reference the EXE?
I am asking because I often write .net programs that I run both under Windows and under Mac OS and my usual solution is to create a DLL with the functionality and then two GUIs, one for each target.
However, it now seems to me as if I could just write a Windows version of my app and then add that Windows version (the EXE file) to my Mac project and reference the Windows EXE rather than a DLL. It also has the added advantage that I can run the Windows version from the Mac folder without adding another file.
Is there any good reason not to do it that way?
If you wish, you can build your all your assemblies as executables (.exe) and references them. There is no diffrence for .NET if a assembly is compiled as executable (.exe) or class library (.dll).
The only diffrence is that an executable has an additional Portable Executable (PE) format and header, so that they can be executed on windows systems. Primarily is this header used to launch the CLR Runtime.
Note: You can also build .dll assemblies as Portable Class Libraries