C#C
C#2y ago
Jānis

Publish to single working .exe

Hi, almost complete beginner with c#, and I'm not sure, what I need to do, to solve it.

Previously I made a very small app with target framework, I think, 4.8.
I simply built the solution, took the .exe file from the solution and could distribute it to others, it simply worked. [1]

Current project is .net 7.0.
When building it, it builds also multiple files [2].
However, I can't simply take the .exe.
It doesn't work without the other four files.

I tried costura, multiple different .csproj options, but none of them work, if I only want to take the .exe and run it from another computer.
The app is very very simple, like ~ 350 loc... I managed to bring it up to 150 MB with embeded dependencies I assume, it still didn't work.
What I should look into, to make it work as single .exe if I want to run it myself?

Another issue I encountered, even if I give all of the files to another person, he didn't have 7.0 runtime, is there some kind of version that should be available by default on windows, or I need to check this with IT?

Best regards!
image.png
image.png
Was this page helpful?