Running Mono C# projects on Mac ... and Winforms - c#

For the first time I am trying Visual Studio for Mac and I located a tutorial for writing a exe that shows a window with a simple menu.
My two questions are:
How does a user of a Mac get the Mono platform? I can't find instructions for deploying Mono. When I look in my exe folder there is no other files. Just the exe.
Maybe this should be a different question but I could not find any "WinForms" version in Visual Studio for mac. I had to use Gtk2 (I think).
If there is a better place to ask these questions please direct me. Thanks.

I know understand that the best course of action was:
Create a Xamarin.Forms multi-platform project.
Create a Cocoa Mac OS project.
Add a reference to project 1 into project 2.
Using Nuget Package Manager download Xamarin.Forms into each project.
Now it is easy to create an application with XAML (similar to WPF).
Visual Studio for Mac creates the multi-platform project (step 1 above) automatically with the Android and iOS platform builds, but not the macOS.
I also see that I don't really need to download Mono as it is all dealt with automatically.

.NET Core does support Mac and Linux. And even though .NET Core now supports Windows Forms. Windows Forms is only supported on Windows. It's unlikely this will ever change due to Windows Forms dependency on the Windows APIs.

Related

Error NETSDK1100: Windows is required to build Windows desktop applications

I am new in C#, in Visual Studio for Mac, and I need to open a project which extension is ".sln".
When I try to do it, a message is displayed:
error NETSDK1100: Windows is required to build Windows desktop applications.
Unable to create package spec for project.
I think I can manage to open some files to modify the code and make it acceptable for Mac, but I don't know where to start searching.
Starting with net6 SDK 6.0.4xx, it will be possible to build WPF/WinForms projects on non-windows operating systems.
It requires <EnableWindowsTargeting>true</EnableWindowsTargeting> to be set in the csproj or a Directory.Build.props file.
https://github.com/dotnet/docs/issues/30076
You are opened solution which includes Windows desktop application (for example WinForms). It is not possible yet (at least in official / standard way) to handle such projects by Visual Studio for Mac OS X. You need to run Visual Studio on Microsoft Windows system.

Can a Xamarin project be built with both Visual Studio AND Xamarin Studio?

I know that you can use either of these tools for creating Xamarin projects, but can I also go between using the two of them? Ex: I am on a Mac, and my co-workers is on Windows?
I used to believe it was possible, but the moment we added the Windows project, we can no longer build for iOS.
When we try to build, we receive an error about not being able to import target WIndows.
I understand this, as I'm on a Mac. Even if I exclude the UWP project from the build process, it still throws this error.
How do you write Xamarin projects on both a Mac and a Windows machine?
Yes, you can. However, XS on a Mac cannot build Windows projects (although you should be able to exclude them from the build), and VS on the PC can only build iOS projects with the aid of a Mac to act as a build server. Otherwise the solution files should be portable between the two environments.

Monodevelop android error

so i downloaded monodevelop...and it installed xamarin studio 5.0.1...the gtkc# is working well...i made an app and run it...everything went well...when i tried to make an android app with c# thru new solution it said the "MainActivity.cs" couldn't be found.I let the default location in documents/projects and named the solution hello.I also have installed the android development add-in from add-in manager.I can't figure out what's the problem...also i had installed the android tools from eclipse.
I think it has something to do with the licensing, as XamarinStudio + Android / iOS is not a free product. I believe that the "re-branded-as-XamarinStudio" MonoDevelop available from the MonoDevelop website is simply missing the stuff needed to create these types of projects.
While I'd be interested in knowing why MonoDevelop has released a crippled (read broken) version of XamarinStudio, one can simply get the fully-functional "XamarinStudio" from the XamarinStudio website, and it will be able to create these project types without this issue (so long as you have a trial, or full license).
It will still be able to create other types of C# projects, just as MonoDevelop used to, as this whole thing is part of the process of moving away from the MonoDevelop name, and having a single product "XamarinStudio".

How to use SQLite on new Windows 8.1 Store app (Visual Studio 2013)

So, I installed Visual Studio 2013 on my Windows 8.1 box. I want to experiment with it and created a new Windows Store Grid App. I want to persist data on a SQLite database, apparently the database of choice for WinRT apps.
Quickly found links to the vsix needed in order to be able to use the SDK: SQLite download page, and downloaded sqlite-winrt81-3080002.vsix.
Installed it, then in my project, added the reference to the newly installed SDK (right click references, add reference, navigate to Windows, select extensions and tick SQLite for Windows Runtime (Windows 8.1) checkbox.
Also quickly found that it won't compile on Any CPU. On Configuration Manager, selected Debug, x64 active platform, that made me able to compile the application.
Finally, while attempting to use the namespace SQLite I noticed VS 2013 isn't recognizing it. Attempted many things like adding reference to the .dll directly, exploring the component to see which namespaces were available (which doesn't show anything), and I'm quickly running out of ideas. Because it's kinda new thing, and with limited interest, google, the saviour, doesn't want to save me today.
So, how one would be able to use the SQLite SDK in their Visual Studio 2013 projects, targeting Windows Runtime 8.1?
These are the contents of my csproj file
UPDATE
Stupid me, thought there was no managed land (.net) in Metro style land. Sorry for causing any confusion.
I installed the VSIX for SQLite and noticed that it is a native DLL to be used in Windows Store 8.1 C++ apps. It is not for managed C# projects.
The current NuGet package for SQLite from what seems to be the 'official' SQLite team is only working for .NET 4.5, if you try to install it, it will error saying it does not support .NET 4.51.
There is also the NuGet package SQLite-net, which works for .NET Windows Store apps. All you need to add is the SQLite using statement.
You will need this NuGet package as it is the managed wrapper for the SQLite, without you will not be able to properly reference the right DLL for SQLite.
Here is the link to the project information from that NuGet package. SQLite Runtime Support
Here is an article on how to use SQLite with Windows Store apps in VS2012 but it should still all apply:
SQLite and Windows Store Apps

C# developing tools on OS X

I was told that VisusalStudio has no version for Mac. So what should I use if I want to develop in C# on Mac ? Anybody has experiences with this ? I'm looking for native IDE, I don't want to run VS using VirtualBox or any virtualization solution.
And if I create application with WPF GUI will it run on Mac ? Or is WPF only for Windows GUI developing ?
MonoDevelop is a free open source IDE based on the Mono project. There's builds available for Linux, MacOS X and Windows.
For GUI development, you'll need to use the GTK+ framework included with Mono - there's no plans to implement WPF on any platform other than Windows. GTK+ is cross-platform, though, so you can compile the same app for MacOS, Windows and Linux if you need to.
EDIT: It appears MonoDevelop also supports WinForms - http://www.mono-project.com/WinForms
There are a couple of alternative IDEs but nothing comparable to MonoDevelop in terms of features - but you can always just write C# code in your favourite editor and compile it using the Mono build tools, of course.
WPF can run on any environment that supports it in its runtime environment. Currently that is only Windows since the Mono project has no plans to implement WPF
Check out the Mono Project.
For an IDE check out MonoDevelop.
You can also check out the MonoTouch to develop to the IPhone.
As already mentioned WPF isn't supported but they do mention an alternative:
Silverlight implement a subset of the
WPF APIs and is available on Windows,
MacOS X and through our own open
source effort Moonlight it is
available on Linux and other Unix
systems.
As far as I know there is no complete IDE that support C# with intelli sense, etc.
So Vmware Fusion + Windows including Studio in Unity mode will be it :)
Simple C# syntax highlighting you can get with textmate.

Categories

Resources