Learn C# on mac? - c#

Is mono the only route , any specific visual studio like editors that you recommend?

Without meaning to state the obvious and miss the point, if you mean a Mac computer rather than a Mac OS, you could install bootcamp or use parallels to run windows on the Mac and then use Visual Studio (there are also free versions of Visual Studio)

Yeah, mono is really your only option, unless some undergrad somewhere has developed some very experimental thing I don't know about. As for an IDE, well I believe the only thing half way stable that will work right now on Mac OS X is Monodevelop:
http://tirania.org/blog/archive/2008/Feb-07-2.html
I mean, you could run Parallels and develop your code on a Windows VM with Visual Studio and as long as you follow certain guidelines about portability, you could use VS to develop your mono apps. Although, you probably might as well get familiar with Monodevelop. It would be interesting to see if SharpDevelop ever gets ported.

Well, you could also try Silverlight...
Pro:
It is an official Microsoft implementation, so it is more likely to work
Its support for recent stuff like C# 3.0 is much better
Con:
It is browser-only, Silverlight apps do not run standalone
You won't get the whole .NET Class Library, only a subset, so it is somewhat limited
You won't get Visual Studio on a Mac
For IDE, I suggest Eclipse Tools for Microsoft Silverlight (apparently it is Windows-only at the moment) you should use MonoDevelop or SharpDevelop or something like that.

Use Xamarin Studio IDE.
https://xamarin.com/mac
Uses Mono and C#. It has any features you might expect from a modern IDE and combines with XCode for GUI.

Mono is pretty much your only route right now, though there are incessant rumours (I wouldn't give much thought to them, though) that Microsoft is planning to port C# to Mac in the future. I'd be very surprised if that happened, though.
As for IDEs, I can't help there... If I want C#, I stick to Visual Studio (run it through Parallels or BootCamp, if you really want to use VS).
Edit: As Graham points out, there is Cocoa#, but I'd caution that simply because the project has stalled, and there's unlikely to be much future for it. :(

I would go the virtualization route, either Parallels or VMware Fusion. Both will run Windows XP and Visual Studio very well on a modern Mac. Windows has the best tools for .NET and C# development and it only makes to use them, especially when you're just starting out.

Virtual Box is my new favorite and open source (means free) VM software. Don't pay for Parallels. Also, with BootCamp, you have to reboot the machine to switch between Windows and OS X, so Virtual Box is the way to go.

Related

C# Interactive in Visual Studio Community on Mac

I'm trying to do some treehouse tutorials on C#. Unfortunately, the instructor is teaching this course in an windows machine with a windows version of VS Community while I follow along VS Community for mac. Got to a point where she is trying to use the C# interactive (REPL) but I can't seem to find it on the mac version. Anyone know if its even possible to do this on the mac? Thanks.
You can't run it in Visual Studio. You can, however, use the terminal.
When you install mono the command csharp gets installed as well.
Simply type csharp and the terminal will become a C# interactive window.
If you have Mono installed you can also use: csi
No Interactive Window support in VS 2017 Mac.
Future versions may have this feature. If it is important you could use Parallels and run the Windows version.
Or work around it by doing the same sorts of things with a debugger and Immediate Window.
Use Xamarin Workbooks!
If you don't like Xamarin Workbooks for whatever reason, you can also use csi in the console, but it doesn't have code completions :/ I couldn't edit Sachin's answer above, but to be more clear, all you need to do is open the terminal and type csi to start the C# interactive tool. Of course this only works after you've installed Visual Studio (it should have installed Mono in the process).

Can I program in C# on a Mac?

I want to learn C# for Unity and my personal computer is a MacBook Air. Can I program in C# on a Mac?
Your first option is Microsoft Visual Studio for Mac which was released in 2017. If you're used to VS ide then I suggested you download this.
If not then you can have a look into MonoDevelop. You can download from here
MRE = Mono Runtime Environment
MDK = Mono Development Kit.
MDK = MRE + Extra tools, libraries, .NET PCL (Portable Class Library) profiles, etc.
If you have an application that you want to run that needs Mono you can install just the MRE.
If you are doing development, writing C# applications, whilst you can sometimes get away with just having the MRE installed, you may hit some missing features such as not having the .NET PCL profiles. So I would install the MDK if you are doing development. Reference
Yes, it is. Microsoft has released Visual Studio Code 2017. It works on Windows, Mac OS, and Linux; It is quite nice development text-editor. It works similar to the full-version, available on Windows - with a few draw-backs, and it will allow to write programs, as well as run and test them right on your Mac.
Microsoft Docs offer a quick getting started tutorial and a Hello World program out-of-the-box with the Visual Studio Code.
You will need to install a few dependencies, however. Which may sound kinda of obvious:
Visual Studio Code
.Net Core SDK
C# extension from the marketplace.
I had good luck getting started and Visual Studio got all of the dependencies for me; so I simply went into the program, opened the integrated terminal (View > Integrated Terminal) and ran the command dotnet new console, and boom, a few seconds later I had a Hello World program, written in C#, running on my MacBook Pro.
There is now a Visual Studio for Mac available as a free community version as well as professional and enterprise versions by subscription.
JetBrains also has an IDE for C#, called Rider, that runs on the Mac. If you use IntelliJ or any of their other products you might like it - it feels better to me than MonoDevelop or Visual Studio for Mac. It is a commercial product but JetBrains offers very generous license terms (as in free) for students and open source projects. They also have a substantial discount for startups.
It is possible, but you won't be able to use Microsoft's tools, you'll need to use a third-party program like Xamarin Studio (MonoDevelop).
Edit
at the time of this answer there wasn't a Microsoft tool/IDE that could be used for developing .net / C# programs on a Mac. Now there are two:
Visual Studio Code
Visual Studio for Mac
Note that while everyone mentions Mono and Xamarin, which you should absolutely look into for C# development, Unity works on Mac directly, specifically Mac OSX 10.6+
while both use the C# language, some of the paradigms espoused by Unity are a little different from standard C# development. I personally recommend learning both.
ADDENDUM: Note that MS has recently announced that they'll be moving the standard .NET implementation cross-platform, and are doing so with the help of the Mono team, so while there's currently a confusing dual set of tools, it'll be shifting away from this in the future
It is entirely possible, if you install a version of Windows using Bootcamp you can switch between the two at start up and have the full functionality of both by installing Visual Studio on the Windows partition. Alternatively, you could use VMware such as Virtual Box and use Windows within your Mac OS.

Version Control in Visual Studio

I'm currently working on a large project, and am about to make some large changes, and was looking for a way to 'backup' my prior work. Is there built in functionality in Visual Studio to work with version control?
This project is developed only by me, and doesn't use Team Foundation Server (which is what most of my googling seems to give me answers on). Ideally, I would like to identify and restore all the different versions of my program as it evolves, without having to worry about totally messing something up...
Cheers and thanks in advance!
---EDIT---
With a version control system though, would that be stored on a seperate server? Or is it possible to store it locally? I'm more just concerned that I will just seriously mess up my code and not be able to undo it at some point...
There are several third-party source control integration tools, such as AnkhSVN or VisualSVN for SVN repositories (I use the former and can gladly recommend it). As far as "built-in", Visual Studio supports Team Foundation Server and Visual Source Safe out of the box, but those are both paid products and VSS should be avoided (in my opinion) for any new work.
Personally, I use TortiseSVN (for Windows integration) and AnkhSVN (for VS integration) with our SVN repository. There are free SVN servers as well, so you can get by with a very good solution while paying $0.
Well, there are a number of free source control alternatives out there and there are plug-ins (free ones) into Visual Studio that will allow you to hook right in. Take a look at those links and pick one that works for you!
Visual Studio has the ability to work with many source control providers. You simply have to hook them up.
Use "Tools->Options->Source Control->Plug-in Selection".
You may be able to use git with VS which means you don't need another dir/server etc for the repo. Consider Using Git with Visual Studio
TFS is really expensive, especially for just you. You can use VisualSVN.
it is a free download to us ANkhsvn. It is a plugin for visual studio that connects to various source control severs. You would first have to have a subversion server setup somewhere. Which is easy enough to do.
There is no built-in Version Control System in VS.NET, however, VS.NET supports multiple version control systems, like TFS, Visual Sourcesafe, SourceGear vault , etc...
As you state, you need a version control system. Look at this answer on selecting a Version Control System.
There are many version management systems. A lot of them are expensives, but... the are many others that are free! Take a look here:
http://producingoss.com/en/vc-systems.html
You can use SVN (Subversion) - one of the most used widely.

As a professional developer is it a must to have a paid version of Visual Studio?

I've seen the express edition of visual studio and it looks great, something you wouldn't expect to be free. I'm curious, however, if as a professional developer (C# mostly) can you work with just the express edition ? Is it worth investing the money in the professional or ultimate edition?
Thank you.
As a professional developer is it a must to have a paid version of Visual Studio ?
No.
There's SharpDevelop and there's MonoDevelop which are great and sometimes even greater then VS. You can use whatever you want, as long as you get the job done.
Yes you can work with the Express edition. Nothing in the EULA forbids you to do so.
No, the Express edition is perfectly fine for professional development - both legally and technically. However, you might soon miss some of the features of the professional and higher versions - especially if you're used to them. ;-) Things that come to mind are refactoring (only very basic in VS2010 Express) and the lack of solution folders in project explorer (for solutions consisting of more than a few projects).
Here you can see the difference :
http://www.microsoft.com/visualstudio/en-us/products
In any case framework is the same. The difference is additional product features across different VS versions.
If you are home developer, Express may be good enough. For a company it a must to have something better.
I wanted to do Windows Mobile development but discovered it is not possible in VS Express version. So you must pay for VS if you want to do Windows Mobile development.

What is the downside to using the Visual Studio Express Editions?

I'm developing an application using Visual C# Express Edition - what is the downside to using the express editions? Are there any limitations on what I can build and release? Will my users be able to tell I'm using the Express Edition?
It won't impact your users, other than by making you less productive by prohibiting add-ons such as ReSharper, TestDriven.NET, etc. and not having some of the built-in features of the commercial editions.
To put it another way: if a word processor didn't have a spell checker, you could still make sure that your documents were spelled correctly, so readers wouldn't know - but it's a lot quicker (usually!) if the tool has it built in...
Here is a huge comparison chart of all versions of Visual Studio, from Express until Team System.
Visual Studio 2008 Product Comparison Guide
No AddIns whatsoever - no ReSharper, no TestDriven.net, no VisualSVN, no nothing
Server Explorer does not support remote databases
No support for solution folders
Express targets only a single Framework - Express 2008 targets .net 3.5 only. (Edit: I was wrong, Express 2008 indeed supports multi-targeting)
Reinstalling Express may require re-registration which is free, but can be shut down any time from Microsoft
Apart from that, it's fine. It uses the same compiler to generate the same code, you just don't get all the Time-Saving tools that VS Professional offers.
The Express debugger does not allow Attach to Process:
The ability to attach the debugger to
an already-running process has also
been removed, hindering scenarios such
as writing Windows services and
re-attaching a debugger under ASP.NET
when errors under the original
debugging session cause breakpoints to
be ignored.
I can live with everything else but that.
Only one language is supported. You can't have an application in C# and a library in C++ in the same solution, for instance.
Also, third party ADO.NET providers are not supported in the designers
See features and tools available with Express editions, Visual Studio Standard and Professional editions, and Visual Studio Tools for Office.
It has no mobile device support - one of the most important features, for me :o)
No MFC visual gui builder for C++.
EDIT
Oops - just read the C# tag. I'll leave this up though in case it comes up in a search for anyone else who might also be using c++
Visual Studio Express can do "most" of what the higher editions can do until you start getting into more advanced things such as trying to install third-party components and get full integration, adding database projects, integration into third-party systems, etc. On that note even Visual Studio Standard lacks several of these features so you'd be looking at Professional (at a minimum) to get a fully robust and feature-rich edition.
The current version of VS Express (I'm writing in 2014) has no diagnostics. No assert method and things like stat monitoring. For me this means I'll use a different version to finish a site because it limits testing and validation. No point in making a sub-par .NET site to be actually used.

Categories