I'm attempting my first crack at a PCL, targeting Windows, WinPhone and Xamarin. I'm finding that some very basic things, like Package and SortedDictionary, won't import (claims they don't exist). I'm sure this exists in Windows and Xamarin (Mono), so I'm a bit lost as to why my Imports doesn't work. Perhaps it's because Xamarin included Silverlight and SL doesn't support it?
Can anyone point me to a big list of supported imports that might help? Or perhaps a comparison tool? There's a scanner tool on the Xamarin web site, but it appears to be broken. I can't find a list on the Xamarin site, and my google-fu has once again failed me.
Here are some features listed, albeit not including Xamarin. OTOH Xamarin is very feature rich and it is unlikely that something is missing because of it. More likely the culprits are Silverlight and WP Silverlight.
You can also try the .NET Portability Analyzer.
Related
I have a Xamarin Forms application that uses shared code. It has three projects, shared, iOS and Android. These are very similar to those which are created when I create a sample application from the Xamarin new project menu.
I am looking to have the application updated and published by a company that has experience in doing this but I am not sure I understand a couple of the work items that have been suggested to me:
Currently, architecture is PCL which is becoming
obsolete.
Move to .NET standards
Could someone explain to me what these work items might mean?
Yes, it will become obsolete at some point. .NET Standard is the evolvement of the PCL libraries.
With PCL libraries you could target a number of platforms and only the functionality that was supported for all targeted platforms were available to you. Associated with each combination of platforms were the profiles. A profile was identified by two or three digits. Notable ones for Xamarin were 111 or 259. Read more on PCLs here: https://learn.microsoft.com/en-us/xamarin/cross-platform/app-fundamentals/pcl
.NET Standard is a specification of the APIs associated to it. If a platform supports a certain version of the .NET Standard, you are guaranteed that all APIs are available. This way, you can simply target a specific .NET Standard version and each platform that supports it will support your application. The .NET Standard specification has gained a lot of traction and is already more cross-platform than a PCL ever was. Most of the creators of NuGet packages are supporting it already and also Xamarin/Microsoft has replaced the PCL with a .NET Standard library in their templates. Read more on .NET Standard as a concept here: https://learn.microsoft.com/en-us/dotnet/standard/net-standard
So, if you have the possibility it might be wise to start moving to the .NET Standard library. That is, if you want to keep supporting your app and need new libraries coming in. If your app is fine the way it is, you can probably keep going with the PCL for a while. Converting is basically: change the csproj structure to the new structure. Retarget your library to netstandard and reinstall all the libraries you have installed, this time to download the .NET Standard compatible version. The last step might be a bit of a pain.
A good resource on converting might be this by Adam Pedley: https://xamarinhelp.com/upgrade-pcl-net-standard-class-library/
There is also a solution to do it automatically: https://smellyc0de.wordpress.com/2018/03/23/automatically-converting-pcl-to-net-standard-2-0-project/
.Net Standard is a specification for a set of APIs. and is the way things are going. With it, comes a higher level of range of .Net SDK APIs you can use, plus most 3rd party Nuget packages will support it. They can support a wider range of platforms. by targeting .Net Standard. Thus you will get access to a larger number of nuget packages. See https://learn.microsoft.com/en-us/dotnet/standard/net-standard
I put my Forms Apps into a .Net Standard library, because it easier to unit test. There is a Xamarin Forms nuget package you can use for testing, which means a lot of UI paths can be verified in code, where previously you had to do it on a device, perhaps with automated testing. https://github.com/jonathanpeppers/Xamarin.Forms.Mocks
Upgrading an existing PCL project to .net standard is a pain. Any more, I just create a new Xamarin Forms solution with the same name/root namespace, with the app as .Net Standard, then copy files over.
I am coming from a native iOS / Android development background.
I am looking for some command line tools that would allow to perform static code analysis on our Xamarin project.
Are you aware of such tools? I have found Gendarme but it seems that it hasn't been updated in a while so I am not sure how actual it is.
Also I have found MonoDevelop.StyleCop which seems to be an add on to Xamarin Studio (although we use Visual Studio for Mac - but it might just work) - but I can't figure our how you can run it from the command line.
What would be your approach into integrating static code analysis in your Xamarin Project Continuous Integration?
Thank you!
EDIT: I'm using macOS so I am interested in tools that run on macOS
Xamarin is basically .NET written with C# or F# so you can use nearly all code analysis tools available for those languages. For a great list see: What static analysis tools are available for C#?
I checked the project Xamarin.Forms using static analyzer PVS-Studio and wrote the article with the results of the check: "Microsoft opened the source code of Xamarin.Forms. We couldn't miss a chance to check it with PVS-Studio". The check of Xamarin.Forms was performed for Windows (we don't have the version for macOS yet), but I still recommend you to write us to discuss this question. We have just started to make an adoption for macOS.
I just started to study Nemerle. Since this is .NET language, I wonder, is possible to use for Windows Phone development? Does Visual Studio support it well?
Nemerle compiler uses System.Reflection.Emit for assembly manipulations. Then it can create assemblies same CLR version only.
I know only one reciepe for build WP assemblies: ildasm ncc.exe, fix all references to WP framework and ilasm it again.
This may not be possible, since Windows Phone runs a subset of the full .NET Framework which is closer to the .NET Compact Framework.
Looking at this page (translated from Russian) it looks like Compact Framework support is something that is/was planned for Nemerle version 2. However that article was written before Jetbrains acquired the project, so objectives may have changed.
Having said that, much more recently (Feb 2013) one of the Nemerle developers spoke about their difficulties in getting Nemerle to support other frameworks. So perhaps it is on their agenda after all.
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.
I'm just starting with windows phone development and was trying to get the datePicker to work. Searching for tutorials, all seem to be pointing to a reference to
C:\Program Files (x86)\Microsoft SDKs\Windows
Phone\v7.0\Toolkit\Nov10\Bin\Microsoft.Phone.Controls.Toolkit.dll
The problem is that i don't have this file (and after a computer search this file doesn't exist at all in my computer) so after looking some more, a found this link that says that i must install the toolkit. This seems quite not right(i was thinking this feature was fully integrated, not a alternate design being such a key-feature).
Analysing the feed i got from google, those link are pretty old(september - november 2010). Has Microsoft redesigned the method to acces dataPicker or is this method still the current official one?
I'm not fully sure of the reason but from the codeplex page:
Straight from Microsoft, both the Silverlight Toolkit and Silverlight
for Windows Phone Toolkit provide the developer community with new
components, functionality, and an efficient way to help shape product
development. Toolkit releases include open source code, samples &
docs, plus design-time support for the Windows Phone platform as well
as the Silverlight browser plugin.
The easiest way to pick and choose what components to install is probably via NuGet.
http://nuget.org/List/Packages/SilverlightToolkitWP
This is more or less the current way. The main changes are that there's now an easier way of getting the toolkit using NuGet and there is a later release that supports WP7 Mango.
I'd recommend getting the sample app so you can see good examples of Toolkit however.
Just download and install the Toolkit which is readily available in the following link,
Silverlight Toolkit.
Then Add reference to the Microsoft.Phone.Controls.Toolkit.dll in the installed folder.
Then you can access it with adding the xaml code,
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"