It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
PLEASE help me because this is VERY important to me and I'd really like to solve this problem ASAP! I've already gone through a ton of horrible problems to get to this point, but I think I'm almost at the end, so I really want to finish it this week! Here's the problem:

I've been using Visual Studio for years but I just upgraded it to the Core versions. I was using 2012, and now I've installed 2015, 2017 and 2019, so I can use whatever version I need.

But what I really need to do is compile a program within Windows 7, such that the resulting program needs to be cross-platform compatible and able to run on a Macintosh.

I've read a page that explains how to do this:

https://stackify.com/cross-platform-net-core-apps/

It's not very long, so you can read it or just skim it if you're familiar with all of this stuff, just to see if it seems accurate. I don't know if there are better pages, but that's the only one that I've found so far, but feel free to suggest any. Note that I can't see the images on the page (they just look gray) so I just read the text. Is anyone else able to see the images?

According to the instructions, it's possible to make such an application as either "framework-dependent" or "self-contained". Correct me if I'm wrong but I interpret this to mean that a self-contained one can be put on any computer and run immediately, without having to install anything else (I'm not sure how this is possible though, because it's not compiled to machine language), but a framework-dependent one would need to at least have the .NET Core runtime installed, right? Or would anything else be required?

However, the thing about that page is that it explains how to create a console application, as in one that runs on the command prompt, like a DOS application. What I need is a regular Windows application that can make windows with buttons, etc. in a GUI. But I'm NOT trying to make an ASP.NET application, because again, correct me if I'm wrong, but at least when I worked on ASP.NET, it was all for web applications (as Visual Studio suggests), but not regular, non-web applications, right? I need to make a NON-web, NON-console application with a GUI, like a standard Windows program such as Word or Excel, for example, but it must be able to run on Windows AND Macintosh using the same compiled .exe file made in .NET.

EDIT: I read through the instructions some more, and if I understand it correctly, it may not be the same file after all, but really, that's alright as long as I can compile it within Windows and it will run on Macintosh!

But the problem is that if I run VS 2015 and try to create a new project, I'm given a drop-down list box at the top of the window, with various options that are all versions of the .NET Framework, but no Core. But if I run VS 2017 or 2019 then I don't get the drop-down list box, but there's a tree list on the left, and whatever I click in there, whether it's Core-specific or something general, all of the options in the main part of the window that say "Core" are either console, web, unit testing, class libraries or other stuff like that, which aren't regular GUI non-web programs.

One thing that was said on the webpage that I mentioned above is that I should have the .NET Core SDK installed, but I'm not sure whether I need to, because it seems like it would be included as part of Visual Studio, or isn't it? I can try and download various versions of .NET Core if you think that will help (would they conflict with each other if I install multiple? I've already installed Framework 4.5 though).

But other than that, I have no idea what to do! Could someone please tell me how to do this? I get the impression that it's supposed to be an easy and standard thing to do, so I must be overlooking something obvious.
Post edited January 29, 2020 by HeresMyAccount
No posts in this topic were marked as the solution yet. If you can help, add your reply
Disclaimer: I’ve only superficially investigated .NET Core and made a couple of tiny utilities with it so far (I’m more of an old-school C++ kinda dev).

Anyhu, AFAIK, regular “Framework dependent” means apps that need the .NET Core runtime installed AND need to be run with the “dotnet” command.

“Framework dependent executables” add an .exe file for Windows (and whatever the executable format is on Mac). But these still need the .NET Core runtime installed.

“Self contained” deployment does not require the .NET Core runtime to be pre-installed. This means that you app will balloon in size, as the runtime will be included with it.

IIRC, you can easily generate executables for one platform on another. (Not done it myself yet, though.)

HOWEVER, .NET Core has historically NOT included a GUI framework. It's so far been for console apps and web servers. I think .NET Core 3.1 is the first to include GUI frameworks.
HOWEVER (yet again), these ONLY target Windows. Microsoft do NOT ship any GUI framework targeting Mac and Linux. (They seem to be investigating the business case.)

For Windows + Mac + Linux cross platform GUI, you’ll need to look into Avalonia.
avatar
brouer: Disclaimer: I’ve only superficially investigated .NET Core and made a couple of tiny utilities with it so far (I’m more of an old-school C++ kinda dev).
I used to use C++ all the time too, but I got tired of it being too much of a pain to do some things.
avatar
brouer: Anyhu, AFAIK, regular “Framework dependent” means apps that need the .NET Core runtime installed AND need to be run with the “dotnet” command.
What dotnet command? Can't the file just be double-clicked to open it?
avatar
brouer: “Framework dependent executables” add an .exe file for Windows (and whatever the executable format is on Mac). But these still need the .NET Core runtime installed.
Alright, that's the such a big deal, because that's easily obtainable and installable, if necessary.
avatar
brouer: “Self contained” deployment does not require the .NET Core runtime to be pre-installed. This means that you app will balloon in size, as the runtime will be included with it.
That's also fine, because it's not as though an executable program is going to take gigabytes.
avatar
brouer: IIRC, you can easily generate executables for one platform on another. (Not done it myself yet, though.)
Well that's great theoretically, but I can't seem to get my programs to compile that way.
avatar
brouer: HOWEVER, .NET Core has historically NOT included a GUI framework. It's so far been for console apps and web servers. I think .NET Core 3.1 is the first to include GUI frameworks.
HOWEVER (yet again), these ONLY target Windows. Microsoft do NOT ship any GUI framework targeting Mac and Linux. (They seem to be investigating the business case.)
ARE YOU KIDDING ME?!?!?! Nowhere on Microsoft's website, Wikipedia, or anywhere else that I've found, does it specify that limitation! It simply says that .NET applications compiled using .NET Core (which as far as I can tell means Visual Studio 2015 or later) will be compatible with all of these operating systems! I thought that was the whole point of upgrading it from the framework to the core! That's the worst case of false advertising I've ever seen!!!

Not to mention the fact that I've just spent months tweaking my computer and researching and testing all kinds of different things, almost causing my computer to break in the process, just to get it to the point that I could finally use .NET Core, for no other reason than because I wanted to make my programs compatible with Macintosh!!!!!

But why would .NET Core 3.1 be compatible with GUI if it doesn't make it cross-platform - what's the point of that?

And what exactly do you mean by "investigating the business case"?
avatar
brouer: For Windows + Mac + Linux cross platform GUI, you’ll need to look into Avalonia.
And that's compatible with .NET projects? Like if I made a project in Visual Studio 2012 then I could transport it into an Avalonia project, compile it and make it usable on Macintosh, even though I'm using Windows 7 to compile it?

Also, if none of that works, I may be able to consider using ASP.NET to do it (that seems to be compatible with .NET Core, but please correct me if I'm wrong), but I haven't really even thought about ASP.NET so I'm not sure whether it'll work with what I'm doing. But refresh my memory, does ASP.NET compile to a byte code the same way that regular Visual Studio applications do or not? One thing that my programs absolutely can NOT be is open source!
Post edited January 30, 2020 by HeresMyAccount
Also, does anyone know of a free (and hopefully easy) way for me to emulate a Macintosh or otherwise run Macintosh programs in Windows 7, so that I can test and make sure that they work?
avatar
HeresMyAccount: snip.
If you need GUI support and want a quick solution, you might want to look into Mono. You can compile the project targeted for .NET 4.x on Windows 7 and use Mono to run it on MacOS.

I don't have any experience with using Mono on a Mac, but works well enough to run .NET 4 apps on Linux.
avatar
HeresMyAccount: Also, does anyone know of a free (and hopefully easy) way for me to emulate a Macintosh or otherwise run Macintosh programs in Windows 7, so that I can test and make sure that they work?
For Mac OS you can try a virtual machine program like Virtual Box and then find an operating system or look into Hackintosh.
MikeMaximus and wolfsite, both good suggestions and I'll look into them tomorrow morning. MikeMaximus, so if I understand you correctly, I don't even need the .NET Core, because 4.x is 2010/2012 if I remember correctly, so even if it was compiled with Visual Studio 2012 then theoretically it should run on Mac using Mono?!

But if anyone else has any suggestions they're welcome also, because frankly I'll try every possible thing that I can! In my experience, unfortunately things tend to go wrong and I have to try them a dozen different ways until I find one that works.
wuts urgent about any of this
it all sounds sci-fi anyways
Post edited January 30, 2020 by Fairfox
avatar
HeresMyAccount: MikeMaximus, so if I understand you correctly, I don't even need the .NET Core, because 4.x is 2010/2012 if I remember correctly, so even if it was compiled with Visual Studio 2012 then theoretically it should run on Mac using Mono?!
Right, you won't need .NET Core if you use Mono. You should be able to target any older .NET version that will work for you. They have a compatability list that shows by version.

If your application is using Window Forms for the GUI (WPF isn't supported yet) and only referencing libraries that come with .NET, it should run on Mono without much or any tweaking.
avatar
Fairfox: wuts urgent about any of this
it all sounds sci-fi anyways
I'm not certain what's urgent about any of this, if they're asking us instead of calling a Microsoft branch office, but what do I know?
avatar
HeresMyAccount: MikeMaximus, so if I understand you correctly, I don't even need the .NET Core, because 4.x is 2010/2012 if I remember correctly, so even if it was compiled with Visual Studio 2012 then theoretically it should run on Mac using Mono?!
avatar
MikeMaximus: Right, you won't need .NET Core if you use Mono. You should be able to target any older .NET version that will work for you. They have a compatability list that shows by version.

If your application is using Window Forms for the GUI (WPF isn't supported yet) and only referencing libraries that come with .NET, it should run on Mono without much or any tweaking.
Well that sounds great, so I'll check it out! I don't think I've ever used WPF anyway.

As for the other posts about it not being "urgent", what do you know? It's personally important to me that I get this working ASAP. How is that not urgent?

But if anyone else has anything helpful to say, I can always use any suggestions, so that I can try every option that might work, just in case it does!
avatar
HeresMyAccount: Not to mention the fact that I've just spent months tweaking my computer and researching and testing all kinds of different things, almost causing my computer to break in the process, just to get it to the point that I could finally use .NET Core, for no other reason than because I wanted to make my programs compatible with Macintosh!!!!!
Commiserations.
May I ask what it was you had to do, to make the computer .NET Core ready?
I've never face any problems with it myself. One of the easiest dev. systems and SDKs to get up and running.
Of course, I don't normally use Visual Studio 201? with .NET Core. The editor Visual Studio Code works at least as well for that in my experience. YMMV.

Though it's a little odd, you hadn't noticed the lack of cross-platform GUI earlier.
avatar
HeresMyAccount: But why would .NET Core 3.1 be compatible with GUI if it doesn't make it cross-platform - what's the point of that?
Server development is a big market.
And many developers prefer the command line these days. (We've kinda come full circle back to the olden days.


Christ on a pogo stick! I'd written a lot more, but the forum editor must have dumped it. I may return to this later. No time right now.
Post edited January 31, 2020 by brouer
*sigh* I can't be arsed to redo all that I'd written. Sorry.
Googling .NET Core cross-platform GUI should give you the info anyway.

I'll just address this bit:
avatar
HeresMyAccount: Also, if none of that works, I may be able to consider using ASP.NET to do it (that seems to be compatible with .NET Core, but please correct me if I'm wrong), but I haven't really even thought about ASP.NET so I'm not sure whether it'll work with what I'm doing. But refresh my memory, does ASP.NET compile to a byte code the same way that regular Visual Studio applications do or not? One thing that my programs absolutely can NOT be is open source!
You do realise that ASP.NET is usually deployed on a web server?

I suppose Blazor (look it up) in Electron could be a (bloated) solution for you. But that's one heck of a learning curve you're looking at there.
Or a slightly less bloated alternative: https://blog.stevensanderson.com/2019/11/01/exploring-lighter-alternatives-to-electron-for-hosting-a-blazor-desktop-app/


Honestly, though, it sounds like the closest match for what you're trying to achieve is best supported by Java's VM with either Swing of JavaFX. If Java the language is too verbose, there's always Kotlin (or even Clojure if you like Lisps).

Python could also have been a great match, if it wasn't for you wanting to keep your source code hidden.
avatar
brouer: Commiserations.
May I ask what it was you had to do, to make the computer .NET Core ready?
I've never face any problems with it myself. One of the easiest dev. systems and SDKs to get up and running.
Of course, I don't normally use Visual Studio 201? with .NET Core. The editor Visual Studio Code works at least as well for that in my experience. YMMV.
Well, I guess normally it wouldn't be a big deal, but Visual Studio stupidly requires an Internet connection to install, since the computer that I develop on is air-gapped, I had to reformat the whole thing and reinstall Windows before I could safely connect it to the Internet.

But I didn't have a copy of Windows 7, even though I SHOULD have a copy of it, but the person who built my computer evidently didn't give me one, so I had to screw around with image backups and all kinds of garbage, testing all sorts of things on a small partition that I made before I could even proceed.

I had to look all over to find various kinds of software, such as drive wiping stuff, file recovery (for testing to make sure that everything has been securely deleted and can't be recovered), ISO burning software, and a whole bunch of other stuff. I had never needed to use any of that stuff before so I didn't have any and didn't know where to get it. I had to research a ton of stuff, finding that one thing after another was either incompatible, wouldn't do what I needed it to do, or otherwise couldn't be downloaded because links were broken, etc. until I FINALLY was able to get everything that I thought I needed.

Then when I finally did reformat, I ended up with all kinds of problems with my USB ports and booting to CDs/DVDs not working correctly, and my keyboard/mouse not working before Windows booted, and Windows not always booting at all, etc.

After that, everything else imaginable went wrong also. My screen savers didn't even work for a while and the computer was shutting down or sleeping even though I explicitly told it not to do those things.

Anyway, this is just a brief summary of probably several hundred things that went wrong.

avatar
brouer: Though it's a little odd, you hadn't noticed the lack of cross-platform GUI earlier.
I didn't notice it because everything that I read had claimed that .NET Framework is not cross-platform but .NET Core is, and will work on Windows, Mac and Linux, but it NEVER specified that it had to be console apps or web apps, or anything like that!

avatar
brouer: *sigh* I can't be arsed to redo all that I'd written. Sorry.
Googling .NET Core cross-platform GUI should give you the info anyway.
I'll look into that, thanks.

avatar
brouer: I suppose Blazor (look it up) in Electron could be a (bloated) solution for you. But that's one heck of a learning curve you're looking at there.
Or a slightly less bloated alternative: https://blog.stevensanderson.com/2019/11/01/exploring-lighter-alternatives-to-electron-for-hosting-a-blazor-desktop-app/
I'll check that too, when I have time...

avatar
brouer: Honestly, though, it sounds like the closest match for what you're trying to achieve is best supported by Java's VM with either Swing of JavaFX. If Java the language is too verbose, there's always Kotlin (or even Clojure if you like Lisps).
I've thought about that, but the reason that I'm hesitant is because:

A: I already wrote the whole thing in .NET, so I'd have to translate it to Java and find some way to get that to work cross-platform also (I know it's supposed to be cross-platform, but I've never had any direct evidence of that, or known how to get it to work).

B: I'm worried that if I translate to any other language than C#, I won't necessarily find compatible code modules/packages/libraries to import, and won't necessarily be able to duplicate the functionality precisely.