Visual Studio Mac & Xamarin - How to solve "You are trying to install this package into a project that targets.."

May 26, 2017

I recently started using Visual Studio for mac. This was a great move by Microsoft by the way. Marrying the Xamarin platform with Visual Studio was a brilliant move as well. I started working with Ice link and Websync from Frozen Mountain (Great Support). When i downloaded their sample, I had trouble with getting the projects to build. I usually start with updating the Nuget packages first. I believe it's best to keep the Visual Studio solution updated as much as possible. I noticed that this issue only happened in the Android project within a Xamarin forms cross platform solution or the Android only solution.

The issue with "You are trying to install this package into a project that targets.."

The sample software was developed with an older version of Android which is perfectly fine, after all it is a sample project. As a developer, you should be well capable of updating the solution yourself. If you're not, troubleshooting plays a big part in development so i would suggest fine tuning those troubleshooting skills. Moving along, As i'm updating the packages a list of packages failed with the error "You are trying to install this package into a project that targets.."

xamarin forms you are trying to install this package into a project that targets

Other issues that may arise.

When trying to build the project after attempting to update the Nuget packages you will receive an error, "The XamlCTask could not be initialized". You're getting this error because of a Nuget package version mismatch. Behind the scenes, when you attempt to update all packages at once, some will update and others will fail.

What's fix?

The fix for me was actually very simple. After speaking with the Frozen Mountain sales team I had an epiphany. The target version is actually specified in the project. Also, keep in mind, you may not have the correct versions installed in the SDK manager. Essentially, all i did was right click the individual project and selected options.

You should see this screen.

visual studio mac project options screen Go to Build -> General and change your target framework to "Use latest installed platform". Your latest version will be appended at the end. The next step is going to Build -> Android Application and change your Target Android version to Automatic. Save the project and solution and proceed to update your Nuget package and build.

xamarin forms change target version Xamarin Forms Change target version

I hope this helps. Thanks for reading.

Copyright © Mage H.D. Inc.
envelopephonemap-marker linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram