How to develop Windows app on Visual Studio for Mac - xamarin

I recently bought an iMac in order to develop my App on Visual Studio for Mac in a better environment (lots of issues on Windows), but on the Visual Studio for mac, there is no UWP projects.
It is understood that I have to create a new .NET project, but what are exactly the steps to follow in order to achieve that correctly for the app to work on Windows with a peace of mind? Should I have gone with Visual Studio code, which support the .NET core framework completely?
I saw on other answers that I need the .NET SDK tool, and so forth, but further details are needed if you don't mind on the why (not the installation stuffs, only the tech savvy explanations for the app to build correctly at the end!

You will need to run a Windows installation (eg, via Parallels or Boot Camp) and then run the Windows version of Visual Studio to create UWP apps.
You can do a lot of the business-logic coding inside Visual Studio on MacOS, but you will need Visual Studio and the Windows SDK to use WinRT types (which are required to build a UWP app) and to correctly build / package the app for deployment.

.NET is a big ecosystem. As you cannot develop all kinds of .NET projects using Visual Studio on Windows (Xamarin.Mac for example), you cannot do the same using Visual Studio for Mac (like you found, WinForms/WPF/UWP and so on). Such limitation comes from vendor SDK availability or other underlying systems.
In your case, you can easily develop web apps, Mac apps, and iOS apps. If you do want to develop Windows specific apps, like the other answer shows, please use Windows.
You mentioned ".NET SDK", but I believe that should be ".NET Core SDK". .NET Core apps are cross platform. Thus, you can develop such apps in Visual Studio for Mac, and then deploy to Windows. However, so far only console apps and web apps can be developed. What might happen in the future is still to be determined.
Visual Studio Code, however, is just a code editor. It won't give you extra flexibility.

For those whom imperatively needs to develop their app on all platforms, here is what I did, and the pros and cons:
Buying an Imac, thinking that I could also develop UWP projects within it
After realizing that I couldn't, I bought a cheap Windows 7 pro License on ebay (around 5$), and installed it on VirtualBox.
From there, I upgraded to Windows 10 for free and installed everything. It worked like a charm.
Cons: Buying a brand new IMac while a Macbook pro would have been better. An old one even since YOU CAN'T upgrade the ram.
Working on 8go of ram computer when you must give 4go of RAM to your VM isn't quite great. 4go gets you a laggy environment! Really frustrating.
So, prefer something older, but up-gradable (a cheap Macbook pro with 16go of RAM would do).
Not to mention that you will have to install Ubuntu as another VM in order to setup a .Net core Server for the majority of you.
What environment to favor while developing, most importantly when you are a C# and Xamarin noob like me?
The best being to develop from Mac as you will have FAR LESS ERRORS AND BUGS than in VS for Windows.
Correcting mistakes is really daunting and the best is really to develop from Mac to mitigate the damages, but it won't be hurdles free as well!
It took me more time debugging than coding within VS Windows.
After developing chunk of your app within Visual Studio MAC, the best is to get the code on the windows machine and arrange it to work in UWP.
UWP apps compile fastly and like a charm, so better is to get rid of errors within macOS, IOS, Android, and then go and adapt to UWP. This is easier IF YOU THINK ABOUT CHOOSING THE CORRECT LIBRARIES (working on all platforms, hence check my last advice).
From VS Mac, compile using macOS as a host! It's the easiest way to develop fastly, and correct your bugs.
Here is an article on how to get started from Mac:
https://blog.xamarin.com/preview-bringing-macos-to-xamarin-forms/
Cons: Always having to commit the code for it's use within UWP. But that's also a good way to save your project as well, so that if you screw up (like it happened to me numerous time) you roll back.
Hope that helps others whom didn't know what to do and where to start.
ALSO:
Don't follow tutorials dating from before 2017. Use the .Netstandard/.NET Core framework to develop your App so that libraries are more portable (following the blog article above should do).
Otherwise, headaches ahead!

Related

Issue installing Microsoft Viual Studio Community edition v2017

I've been trying to install VSCommunity Edition for the last few hours with no luck. If you check the screenshot attached. You'll see that I can change the directories for installation for the first 2 requirements, but im unable to change the directory for the 3rd option (the SDK install along with others) which just happen to be the very large percentage of files. It's wanting to install over 45gb of files on my C Drive which is just a 50gb SSD.
enter image description herehttps://i.imgur.com/burFR90.jpg
I want to switch to D, and the only thing i can see fro any of the Microsoft help docs and posts is "You can change this upon fresh installation".
Which this is. I've uninstalled anything else remotely like it just to be sure.
Do any of you have any ideas or any experience with this issue, or anything i can try? I simply don't have enough space to install on C, and because of this, i can't start learning c# which is required for work.
Thanks so much in advance guys, it's really getting me worried now.
Although I can only guess why Visual Studio is locking down the SDK path, here's a few workarounds and recommendations:
In your screenshot, the installer warns you about possible performance effects of installing Visual Studio on your D drive. I assume this is because your D drive is not an SSD. Microsoft's Visual Studio system requirements document recommends that you install to an SSD, and based on community experience, this is one recommendation you really want to stick to, otherwise IDE responsiveness may be well below your expectations, especially if you decide to install extensions in future.
Instead, you might want to reconsider the set of components that you're installing. If you're only getting started with C#, you'll probably be just fine with developing class libraries, console and web applications targeting .NET Framework or .NET Core. If this is the case, you might want to go to the Workloads tab in the installer and opt out of some of the heaviest workloads (such as Mobile development with .NET). Consider only installing .NET desktop development, ASP.NET and web development, Azure development and .NET Core cross-platform development. If you only select these, your installation is going to be much slimmer.
If minimizing Visual Studio installation as shown above isn't enough, consider an alternative way of setting up your .NET development environment. For example, you can download and install .NET Core SDK and .NET Core Runtime, and use one of the two most prominent alternative code editors: Visual Studio Code or JetBrains Rider that are both quite compact.

Visual Studio on MacBook

I'm new to programming, and still learning. Anyway, is it possible to use Visual Studio for Apache Cordova on OS X? Or do I have to use Virtual Machine for Windows?
If I want to make apps for both iOS and Android, do I need to write my code twice? (Hybrid Mobile App).
You can use Visual Studio on your mac by running Windows 8.1 or 10 in a virtual machine or using bootcamp to boot directly into windows 8.1 or 10.
I personally use the virtual machine approach for my development. Using a Mac with a Windows VM I can target iOS, Android, and Windows Phone. You can read my blog post here on how to setup your environment (you might also want to check out part 1 as well):
http://trunica.net/building-hybrid-mobile-apps-part-2.html
No you do not need to write your code twice. That's the beauty of Cordova! About 95% to close 100% of your code should be exactly the same across the platforms.
You can use Cordova directly on your Mac if you want and develop for both iOS and Android without using Visual Studio. I do however recommend using Visual Studio since it adds a lot of nice features for development (additional emulators, easier configuration, etc...).
as Brad said, you can't use Visual Studio without a Windows. But, the Visual Studio Development Team built a CLI called TACO (Tools for Apache Cordova)
With that cli, you have some features very cool for beginners. Take a look http://taco.tools/docs/getting-started.html

What options do I have in terms of porting my XNA game to Mac?

I've been reading a lot into this and MonoMac/Mono seemed to be the best if not one of the only ways to go about it. I do have a MacBook Pro and it seems Xamarin bought Mono and wants something like $800 for a business edition to be able to load in Visual Studio projects. I only downloaded the free version so when I tried to load in my VS project on my Mac into Xamarin it said it didn't recognize it and that's when I discovered it seemed I needed a business edition.
A lot of what my search found was stuff that was 1-2 years old and even older. Things seemed to have changed a bit since then and with the Xamarin integrating Mono sort of thing. I've been working on an XNA 4.0 game for PC for over 7 months now and I'd like to have a Mac version. Apparently games like Magicka have figured it out and were made in XNA. I plan to release on Steam so I suppose I need to find a way to try and make it work with Steam if that's possible too. I don't really use my MacBook that often and I don't have Steam on it so I'm not really sure how to go about this.
I guess it comes down to this. I don't understand the current situation of MonoMac and Xamarin and did they aquire Mono? Do I need that expensive business edition? Are there alternatives? How does this tie in to being able to release a Mac version on Steam?
Most of the information I can find is a few years ago now and a lot has changed it seems.
MonoGame is a re-implementation of the XNA API for various platforms, including Mac.
It depends on Mono to provide a C# runtime across different platforms. And on platform specific versions of Mono (such as MonoMac, MonoTouch, etc, from Xamarin) to provide the API bindings and other features specific to those platforms.
You don't so much "load" an existing Visual Studio project as create a new project - either in Visual Studio (if the tools are available and you've bought them - but I don't think this is the case for Mac) or MonoDevelop or Xamarin studio.
To your new project, you would add your existing source files and add a reference to the MonoGame library for that platform. That MonoGame library will provide versions of the classes in the Microsoft.Xna.Framework namespace that work on that platform. Your code gets compiled against these alternate classes, creating a new binary specific for that platform.
(MonoGame will probably have more in-depth documentation of the process on their website, including how to deal with game content.)
Put simply: Use MonoGame. It is an alternate version of the XNA library, not a conversion tool.

Windows Mobile Development Under Mac OS X

I'm developing applications for iPhone and Android on my Mac, but now I want to port them to Windows Mobile. I know that it requires Visual Studio, but that's just if you want to make .Net applications. Then I want to know if there is any alternative, something like Mono...
Windows Phone 7 (unlike Windows Mobile) is quite a closed system with one development environment supported. I.e. you are stuck with Visual Studio and, consequently, Windows.
Update: Windows Mobile 6.x is not much better for MacOS developer. For .NET CF you use Visuaal Studio 2005 or 2008. For native code development you could use Visual Studio 2005 (if memory serves) or, before it, there existed eMbedded Visual Studio 4 (and embedded visual tools 3 earlier), both being similar to Visual Studio 6 (and probably built using the same code base).
Alternatives included FreePascal (Pascal language, native code compilation) and NSBasic (interpreted BASIC language, if memory serves).
But all those tools were for Windows only.
You'll need Visual Studio for both managed and native Windows Mobile applications. I don't think Mono supports .NETCF and I don't think SharpDevelop does either.
You might need to install a Windows virtual machine to run on your Mac. Or... get a PC for Windows development. I have both a PC and Mac workstation on my desk since I do iPhone, Android, and .NET all together.
I am actually looking at starting a project to do this using Mono and Moonlight. Granted, I am in the very early stages of research but I think that it can be done and I am hoping to start getting some people together to help in the near future. I will post the github repo back here when I get something going.
PLease have a look into this
http://blogs.msdn.com/b/interoperability/archive/2012/12/21/how-to-develop-for-windows-phone-8-on-your-mac.aspx
there is this Visual studio code which can be leveraged to initiate and test some basic wiMo app development

How to start Qt development on Windows, but targeting Maemo 5?

I've recently heard about Qt and read about how fun it is to develop with. By the way, I'm also buying a Nokia N900 and I heard that its operating system, Maemo 5, supports Qt quite nicely, so I thought I'll give it a shot.
I'm a .NET developer, so I'd prefer to develop on Windows, and if it is possible, using Visual Studio.
I downloaded the latest Qt SDK. I started up the Qt Creator and created a simple "Qt4 Gui Application". It was working fine, however, I couldn't find any options to compile for Maemo 5 anywhere.
Then, I downloaded the Visual Studio plugin and tried to create a "Qt Application" with that, however, no matter which Qt project type I chose, after clicking the OK button, the dialog just kept popping up again, so it couldn't create anything.
I also read about the Maemo 5 SDK, however, it only seems to work on Linux. (Every walkthrough for Windows started with setting up a virtual machine with Linux.) However, I'm not experienced with Linux at all, so I'd prefer to stay on Windows.
So my question is: is it possible to create Qt applications that will run on Maemo 5 while developing on Windows, or this is impossible?
Thank you in advance for any answers.
EDIT (Solution):
Since the time I started this question, a very nice development tool, the Nokia Qt SDK solves this problem very well. It is cross-platform and can be used to develop Symbian and Maemo apps alike. For the Maemo toolchain, it uses MADDE, which is exactly the tool recommended by the answer. (Note that it is no longer a technical preview anymore.)
Here is a very nice introduction video about the Nokia Qt SDK.
I would suggest getting used to Linux; after all, Maemo (or MeeGo, now) is really Linux underneath, and the official SDK is the Linux-based scratchbox.
That being said, there exists an unofficial community project MADDE:
This is a TECHNICAL PREVIEW of a new development tool for Maemo. MADDE stands for Maemo Application Development and Debugging Environment and offers the following features:
Command-line cross-compiling
Multi-platform support (Linux (32-bit/64-bit), Windows, Mac OS X)
Configurable for different targets & toolchains
Client for the device to simplify the development process
Simplicity
You are welcome to test the tool in your development process. But keep in mind that this is a technical preview. We highly appreciate your feedback in talk, the developer list and especially in bugzilla (Developer Platform -> MADDE).

Resources