Building Xamarin project - c#

I am trying to launch my Xamarin project (which is just the base project Xamarin comes with) but boy is it a nightmare. First of all I have had the IDE00006 error which never, never seems to go away. I have tried everything and some research online has told me that I need to go back to version 23.3.0 for my NuGet packages to fix this error. And so I am trying to do so but now that wont happen as I get this error:
Could not install package `Xamarin.Android.Support.v4 23.3.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile259', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
I don't know what to do, I feel I have tried everything. A lot of research has outdated versions of Xamarin that do not work with my situation but some has shown me that I have something wrong with my portable class libraries or something. I don't know what to do, please help.

Related

Xamarin.Forms Migration to AndroidX: Xamarin.Android.Support.v4 is using Java.Interop.JavaLibraryReferenceAttribute

I am currently migrating a Xamarin.Forms project to Xamarin.Forms 5 and AndroidX. I get the following errors and don't really have any idea how to fix them. I removed all support library Nuget packages and replaced them with AndroidX.
Maybe it comes from an external dependency which still uses the old support library, but how do I find out which one it is? There are hundreds of dependencies. The error message is not precise enough.

(Nuget PackageReference) Xamarin app builds even when I don't add a reference to Xamarin.Forms

I have a solution with a bunch of Xamarin.Forms cross-platform apps. I'm in the middle of a refactoring where I'm migrating things to Nuget PackageReferences. While doing so I encountered a few problems with portable app projects that referenced Xamarin.Forms, so I decided to uninstall the package from these apps and re-install it, then everything worked perfectly. While doing so, however, I realized that if I didn't reinstall Xamarin.Forms on the portable app package, things would still compile and work.
Can someone please explain to me how it's possible that a C# project that contains Xamarin.Forms code in it doesn't need to have a reference to the Xamarin.Forms package to compile? And does this have to do with Nuget PackageReferences?
Syncfusion.Xamarin.SfChart has a Xamarin.Forms dependency and thus it is auto-added to your project.
Dependencies
Syncfusion.Xamarin.Core (>= 18.2.0.54)
Xamarin.Forms (>= 3.6.0.344457)
re: https://www.nuget.org/packages/Syncfusion.Xamarin.SfChart
as it is well explained before another package has a reference to Xamarin.Forms, but... that's my addition to the response. I see in your code that you have a using Xamarin.Forms; statement, you are adding it as an indirect reference and then you are adding it to that part of code in a using statement that is not erroring. If that should not be added, then it will show with an underlying red mark, then in an error.
For more information about references, please go to https://learn.microsoft.com/en-us/visualstudio/ide/managing-references-in-a-project?view=vs-2019

System.Media missing assembly and no nuget package for Console Project

I'm currently working on a console game and I would like to play sounds sometimes.
After a bit of research I found that I need to use System. Media. SoundPlayer class, but unable to find the System. Media namespace. I've reached several Stack Of questions, but they were inefficient in my case.
I might notice you that I've got an error while attempting manual package addition:
Unable to find an instance of Microsoft. VisualStudio.Shell.Interop.IVsReferenceManager
so I might not be able to add it manually.
I could not find a package called System. Media via VS nuget Package Explorer.
If someone could help me, I'll be highly thankful
to gain access to System.Media namespace, you'll need to install System.Windows.Extensions nuget package as #bolkay suggested. This require >=3.0 version of .net core.

Error loading packages in cross platform c# application

I offloaded a project which involved making a cross platform app from a website. My friend who was supposed to do the project, has given me a solution that contains a portable section and a droid section. The ios and windows apps will be made once i complete the remaining portions of the portable code.
Now, he used some packages that are failing to load completely on my system. He had compiled an apk from this code, so this code must be working, but I cannot resolve the issues with the packages. I removed the packages directory from the project he supplied to me, and rebuilt the project hoping the packages would restore themselves correctly. But I ended up with the same errors again.
Then I found that "Mono.Android" and "RestSharp" were marked with warning signs under the references list. So I removed these two, and tried installing them fresh from Nuget Package Manager. Trying to install RestSharp gave me the following error:
Could not install package 'RestSharp 104.5.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile259', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
And I also cannot find "Mono.Android" package in the Nuget Package Manager. My friend was unable to help me out on this. Please suggest how to get this project working.
Thanks in advance.
Debopam Parua

How to install Microsoft.Azure.Devices NuGet package for Unity?

I was working with Unity and Hololens and tried to establish connection to Azure Iot Hub via MQTT protocol. Microsoft provides a tutorial for getting started with Azure IoT Hub in C#, but unfortunately, I encountered a problem with the tutorial:
In the picture above, I have selected Microsoft.Azure.Device NuGet package for installation. I have tried version 1.0.0 and also the latest one available, 1.2.4. The projects were automatically generated by Unity and that is probably the reason, why I do encounter this problem. Which problem? After I try to install the selected NuGet, I encounter the following error:
Could not install package 'Microsoft.Azure.Devices 1.2.4'. You are
trying to install this package into a project that targets
'.NETFramework,Version=v3.5,Profile=Unity Full v3.5', but the package
does not contain any assembly references or content files that are
compatible with that framework. For more information, contact the
package author.
I was like, "Hmm, I must have wrong .NET framework version. I wonder if I can change that..." I tried to go to project properties like this
Microsoft advises changing .NET framework from Properties context menu item:
https://technet.microsoft.com/fi-fi/library/bb772098(v=vs.90).aspx (4.24.2017)
https://msdn.microsoft.com/en-us/library/bb398202(v=vs.100).aspx (4.24.2017)
However, this feature must be blocked by something, because the view that is supposed to open flashes white and disappears immediately. I suppose Unity doesn't like people tinkering with project properties, but what else can I do? Incompatible .NET framework issue needs to be resolved, so that the NuGet package can be installed, but how do I do that?
In short, how to install Microsoft.Azure.Devices NuGet package for Unity?
Sorry, this isn't possible due Unity's restriction to .net 3.5.
To be exactly, they use a custom version of mono-2.
You could try the new (experimental) .net 4.6 settings in Unity 5.6.
https://forum.unity3d.com/threads/upgraded-mono-net-in-editor-on-5-5-0b4.433541/

Categories