Page 1 of 1

Making DOS / Win 3.11 / Win 9x apps with visual studio

Posted: Thu Nov 05, 2020 8:38 am
by Caldor
I just came across this. I was asked to make my Visual Studio console apps into a single EXE file and I figured, yeah, that should be possible and would be pretty useful. So I looked into it and to my surprise its only rather recently that it had become possible to do this. Using .Net Core 3.x, which is less than a year old. I think its even less than 2 years old even if you count the beta and it was a feature they added to .Net Core 3, it did not have it at the beginning.

These EXE files are called self-contained EXE files, and they have a trim option, so they contain the .Net Core runtime itself and all the DLLs and such. So I though... does that mean it might even run under DOS or will it still require Windows? I googled and found I was not the only one to have thought about this, someone had already done it and succeeded. Normally these self-contained EXE files would be at least 28MB because they contain everything, and that is even if you use a trimming feature. But he manages to bring a compiled EXE down to 27kb! :o

I can probably not replicate that, but I think I will try just for the fun of it. Here is a link to the article:
https://www.hanselman.com/blog/net-ever ... 11-and-dos

Re: Making DOS / Win 3.11 / Win 9x apps with visual studio

Posted: Thu Nov 05, 2020 12:58 pm
by Caldor
I managed to compile an exe file that is less than 5 mb using some of what was used to make that 8kb app.

I have attached it here, not sure if it can run under DOS because its compiled with x64. I will try testing it when I get home.

Re: Making DOS / Win 3.11 / Win 9x apps with visual studio

Posted: Thu Nov 05, 2020 1:08 pm
by Caldor
There is a Twitter thread here, also linked in the article where he runs a C# app in Windows 3.11.
https://twitter.com/MStrehovsky/status/ ... 2352034818

Re: Making DOS / Win 3.11 / Win 9x apps with visual studio

Posted: Fri Nov 06, 2020 10:53 pm
by jrronimo
This is awesome stuff. Thanks for sharing!

Re: Making DOS / Win 3.11 / Win 9x apps with visual studio

Posted: Tue Nov 10, 2020 9:34 am
by Caldor
If others want to experiment:

Here is the 64 bit program that can be used to run 64bit code in DOS, but it requires a 64 bit CPU.
https://github.com/Baron-von-Riedesel/Dos64-stub

More relevant for AO486 is the HX DOS Extender:
https://github.com/Baron-von-Riedesel/HX/releases

Both are on the same git as the link shows, and I asked him about running 32 bit programs in DOS and his answer was:
"The closest match to dos64stb.bin in 32-bit would be the stub loadpe.bin in HX."
His response is in this git issue thread:
https://github.com/Baron-von-Riedesel/D ... b/issues/3

I have a lot of interesting things I want to try these days though, so not sure when I will get around to trying this. I also got responses on Twitter from the one who got C# code compiled with a custom compiler to run under Windows 3.11 and DOS. He had looked into HX but had not tried it yet. He did get the Dos64-stub working though under DOSBox and he got his snake game to run under DOS that way.