Fody/Costura

When will .net 6.0 be supported?

FreeVB opened this issue · 10 comments

When will .net 6.0 be supported

Why would .NET 6 not be supported at the moment? Are you encountering any issues?

https://user-images.githubusercontent.com/30093956/138786189-7b11e1f3-54d3-4ae8-a128-3c92d08b9dae.png

ww

I used it the same as .net 4.8, but as shown in this picture, it didn't work as before.

asd

I tried to test a new blank project and the result was the same.

What is not the same? If you create a release build and only copy the exe, it's not working?

Note that the runtime assemblies (per target architecture) need to be embedded and extracted separately.

Here is an example on how we dynamically extract and load the .NET 5 / 6 (runtime) assemblies:

https://github.com/WildGums/Orc.Extensibility/blob/develop/src/Orc.Extensibility/Watchers/AppDomainRuntimeAssemblyWatcher.cs

It means that the DLL referenced by the project is not included in the EXE。

What dll? Have you checked the costura detailed logs and the produced assembly resources?

In the past .net 4.8, all referenced DLLs will be packaged into a complete EXE after compilation, but it doesn't seem to work properly now. If it doesn't work, I can only continue to use .net 4.8 or consider other packaging tools.

I am using the Chinese version of vs 2022. The frame is .net 6.0

Maybe I found the reason: originally .net 4.8 packaged all DLLs in EXE, now it is packaged in WinFormsApp1.dll?

This is something that I came to check on too.

Previously Fody would package everything into a single .exe file and that file was essentially portable - it was also incredibly small!! - for comparison in my example, the Fody .exe was 310kb - the windows all-in-one option is 136mb.

Now it creates a file that is about 1/3rd smaller (in my example, 300kb to 200kb) but also produces a .DLL file that is about 2mb in size (about 6 times larger than the .exe in original format).

It also prompts this message if you attempt to run the .exe outside of the BIN/Release folder:

"To run this application, you must install .NET Desktop Runtime 6.0.1 (x64)"

Which it doesn't ask about when running in the folder in which it is created?

Attempting to run the .exe without the .dll file results in nothing happening. I did read somewhere that the code is now in the .dll file rather than in the .exe as before...but a little above my paygrade.

There seems to be several things involved here:

  1. You can choose to pack the whole .NET runtime with you app (definitely not supported, you should really not want this, will result in a 100 mb executable)
  2. .NET (core) always packages into .dll and adds the executable as shim, based on the target platform (in this case windows, but for non-windows an exe makes no sense)

Whenever you inspect your assemblies, you'll (from the top of my head) notice that the .dll is what you expect your exe to be, and the .exe is a native executable that wraps calls your .dll).

I think it's best to investigate the support for single executables by .NET (core) itself and not use Costura for such cases.