locked
Cannot Create New Xamarin.Forms Project (PCL) in Xamarin Studio - Win10, VS2015 RRS feed

  • Question

  • User69287 posted

    Frustrating. Everything used to work just fine, now I can't even create a new forms project. Xamarin studio will not add the xamarin.forms package. The only thing that I think has changed is that I switched my installation of VS to 2015 Enterprise. I tried reinstalling, repairing, etc to no avail. I also tried changing the profile after creation of the new project and that didn't even work.

    Here is the error I get: Could not install package 'Xamarin.Forms 1.5.0.6447'. You are trying to install this package into a project that targets 'portable-net45+dnxcore50+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10', 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.

    Thanks for any suggestions or help.

    Tuesday, October 6, 2015 4:19 PM

All replies

  • User18049 posted

    This error is coming from Xamarin Studio?

    It looks like Visual Studio has added dnxcore to the PCL profile's supported frameworks. I have VS 2015and ASP.NET 5 beta 7 installed and there is only one PCL profile that supports DNXCore and that is for PCL version 5.0. From your error message it looks like Profile 259 has been changed so it indicates it supports dnxcore so NuGet believes the Xamarin.Forms NuGet package is incompatible, since it does not support dnxcore. For Profile 259 the directory should be:

    C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile\Profile259\SupportedFrameworks
    

    In that directory there will be some .xml files. My guess is that there is an ASP.NET Core 5.0.xml file in there, or something similar, which is causing NuGet to report that error in Xamarin Studio.

    Tuesday, October 6, 2015 6:02 PM
  • User69287 posted

    Yes, it is coming from Xamarin Studio. So what do I do? Delete the file if it is there?

    Tuesday, October 6, 2015 6:14 PM
  • User69287 posted

    Removed file from directory, but didn't help. Still same error.

    Tuesday, October 6, 2015 6:31 PM
  • User18049 posted

    Removing the file from the directory should fix it.

    You will need to restart Xamarin Studio.

    Also check the PCL project .csproj file to confirm it is using Profile259. I may have the wrong profile number.

    Tuesday, October 6, 2015 6:52 PM
  • User69287 posted

    Thanks for your help Matt.

    Still doesn't work. Removed file. Still can't add xamarin.forms package. Rebooted machine. Changed profile to 259. Still doesn't work. I guess I'm paying for a product that just doesn't work anymore.

    Extremely frustrated.

    Tuesday, October 6, 2015 8:22 PM
  • User18049 posted

    Not sure why it is not working for you.

    In each of the PCL profiles there is a SupportedFramework directory with .xml files that define what frameworks that particular profile supports. NuGet will load these .xml files and build a table of information with a mapping from the PCL Profile to the supported frameworks. This information is cached so if it changes Xamarin Studio would need to be restarted to pick up the latest changes. The information shown in the error message is basically NuGet taking the PCL profile number and instead of showing that it shows the frameworks defined by those .xml files.

    Could not install package 'Xamarin.Forms 1.5.0.6447'. 
    You are trying to install this package into a project that targets 
    'portable-net45+dnxcore50+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10'
    

    dnxcore50 would be shown in the error message if there is an .xml file that contains DNXCore5.0 in the supported frameworks directory. I am assuming you still getting the same error message that includes dnxcore50.

    On Windows I would expect the PCL framework for Profile259 to be:

    portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10
    

    The Xamarin.Forms NuGet package will install into a project with the above PCL profile.

    Not sure what to suggest apart from removing all the ASP.NET Core 5.0.xml files or opening the .xml files in the SupportedFrameworks directory to see if dnxcore is defined in one of them somehow. I also have a MonoPcl.exe console app which can be run with a list argument to see the PCL profiles as defined by NuGet. The source code is available for this console app or you can download and extract it from an .mpack file. The .mpack file is just a .zip file so you can rename it and then extract the MonoPcl.exe.

    Wednesday, October 7, 2015 8:19 AM
  • User69287 posted

    So, it finally worked.

    Here is what I did: Deleted all asp.net core 5.0 files in all profiles and then deleted the reference to 5.0 core in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.5\Profile\Profile259\RedistList\FrameworkList

    All seems to work now.

    Thanks for your help.

    Wednesday, October 7, 2015 8:19 PM
  • User68480 posted

    Will this type of workaround break Universal Apps going forward? I am not a PCL profile guru, but it was my understanding from watching videos from MS that NuGet had to change because the new Universal Apps structure was adding the netcore stuff (among other compiler targets) and that the then current NuGet format did not scale well. This was due to having to precompile all possible permutations of all targets beforehand I believe.

    For my PCL library (not Forms), I simply did the NuGet management in VS 2015 and it worked for me. Of course, this path would also necessitate me continuing to use VS for the upgrades of these packages going forward, but that is a (relatively) minor inconvenience for me right now.

    I would simply be extremely hesitant to delete/remove/fiddle with any of the MS framework internal files without knowing more about the repercussions. (Especially since I am hoping to do some Universal Apps in the near future!!)

    Monday, October 12, 2015 4:40 PM
  • User18049 posted

    If you are worried about it breaking VS 2015 in the future then I would take a backup copy of the file. You can always copy it back again afterwards.

    I have VS 2015 and the latest ASP.NET 5 and I do not have the ASP.NET Core 5.0.xml files.

    The reason NuGet v3 in VS 2015 works is that NuGet v3 hard codes the PCL profile information and does not use any of the PCL .xml files. So as far as I am aware the PCL .xml files are not used by NuGet in VS 2015.

    If you do not remove the ASP.NET Core 5.0.xml files, at least temporarily, then there is no way to add the Xamarin.Forms NuGet package to a PCL project using Xamarin Studio. You would have to manually setup the references or use VS 2015. VS 2013 would not work either.

    Monday, October 12, 2015 6:41 PM
  • User122628 posted

    @mattward Hi so after all these posts , is there any way to use System.Net.Http in PCL projects in xamarin studio (mac) Ver. 5.9.7.22 ??? I've tried to use another Ver. off .net.http but it returned many errors and couldn't be installed .

    Saturday, October 31, 2015 12:09 PM
  • User169802 posted

    I searched for 2 days to include System.Net.Http on Xamarin studio for mac, but since nugget3.0 doesn't work on it yet, you can't include that one. However, if you search in the nugget package browser for "System.Net.Http", and scroll all the way down you find a file with the word "mono" in it. that one will work. Install that one, and then you can include it.

    Saturday, October 31, 2015 1:33 PM
  • User18049 posted

    @plusboy2 - You cannot use the latest System.Net.Http NuGet package (version 4.0.0.0). It does not provide any assemblies for Xamarin and also indicates that it needs a NuGet v3 client.

    Older versions of System.Net.Http, such as version 2, install the Microsoft.Net.Http NuGet package, which does have assemblies for Xamarin.

    Otherwise you will need to look for other NuGet packages that do what you want.

    Sunday, November 1, 2015 1:15 PM
  • User122628 posted

    @mattward @BertBijnens I think the simplest way is to write PCL in VS2015 and then import dll file into Xamarin mac.

    ok thanks

    Sunday, November 1, 2015 1:20 PM
  • User169802 posted

    I got the same problem in xamaran studio OS X. I can't create a Xamarin forms application, also if i open one, it can't load IOS and Android for some reason. This happens at random moment, and the previous time i fixed this by reinstalling os x Anyone an idea on how to fix this?

    Sunday, November 1, 2015 3:13 PM
  • User51933 posted

    For what it's worth, I'm having the same issue as the original post. Have removed the ASP.NET XML from all profile definitions...and was then able to create a project in Xamarin Studio. Just removing it from Profile 259 was not enough.

    Monday, November 2, 2015 4:16 PM
  • User169802 posted

    Thanks, does someone know where to find the mrofiles on os x? This kinda becomes a pain...

    Wednesday, November 4, 2015 11:22 AM
  • User18049 posted

    @BertBijnens - This problem only occurs on Windows. On the Mac the PCL profile xml files are installed with Mono and they do not include dnxcore so this problem does not occur on the Mac.

    The PCL profiles on the Mac should be in the directory:

    /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable
    
    Wednesday, November 4, 2015 11:28 AM
  • User169802 posted

    I think i missread this thread the first time, on my mac ameverything worked perfectly, but suddenly i couldn't create new xamarin.forms projects and in older projects it couldn't find the ios and android files anymore, it got a tellow triangle after the applicationnale.droid and .ios

    Wednesday, November 4, 2015 11:34 AM
  • User169802 posted

    @mattward This error displays in the project after the Projectname.Droid and Projectname.IOS "this project type requires xamarin.Android to be installed" "this project type requires xamarin.Ios to be installed"

    When i try to create a new project, the xamarin.Forms items do not appear. Everything worked perfectly, but at some random moment, it just wouldn't compile anymore and i got these messages.

    This is the second time this happens to me, the first time i had to reinstall OS X

    Wednesday, November 4, 2015 11:39 AM
  • User18049 posted

    I would check the Android and iOS addins are enabled in the Addin Manager.

    Then I would try installing Xamarin.iOS and Xamarin.Android again. You can download the individual packages from your (https://store.xamarin.com/account/my/subscription/downloads)[account page].

    Wednesday, November 4, 2015 11:44 AM