locked
CocosSharp 1.3.1 on Mac OS, no go RRS feed

  • Question

  • User68584 posted

    This morning I tried to update my Mac OS project to CS 1.3.1. Didn't work. Here's what I did:

    BTW, the Mac project is targeting Classic API because it had to in order to use CocosSharp.

    CocosSharp package update to 1.3.1 was available. I selected "Update" on the CocosSharp package (I was pretty sure this wouldn't work, and that I would need to update the project to unified, but just for giggles, I went for it). Got this error in the Package Console:

    Could not install package 'CocosSharp.MacOS 1.3.1.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.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 expected an error (maybe not that one) so I reverted and then updated the Mac OS project to the unified preview. After doing that and casting some nints to ints, but not updating CocosSharp, I got this single (expected) build error:

    The assembly 'XamMac.dll' is not compatible with this tool or profile (MM1402)

    This was caused by CocosSharp 1.3.0 wanting to reference XamMac.dll, so I updated the CocosSharp package to 1.3.1 and got this error in the Package Console:

    Could not install package 'CocosSharp.MacOS 1.3.1.0'. You are trying to install this package into a project that targets 'Xamarin.Mac,Version=v2.0', 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.

    So, basically, I'm in a situation where I can't upgrade my Mac OS project to CS 1.3.1. It doesn't work with Classic or Unified.

    Help.

    Monday, January 26, 2015 3:05 PM

All replies

  • User68494 posted

    Unified is only available for iOS. No reason to convert your projects yet for Xamarin Mac.

    Monday, January 26, 2015 4:15 PM
  • User68584 posted

    @kjpou1

    Unified is only available for iOS. No reason to convert your projects yet for Xamarin Mac.

    I was thinking the reason would be to be able to update the CocosSharp package to the latest version. As it is now, my Mac project is stuck at CS 1.3.0 - I can't update the CS package. There's more in the CocosSharp updates (now and future) than going from classic to unified. Mac projects will need the CS bug fixes and feature enhancements, too.

    I mean, right now my Mac project is telling me there's a CS package update available - an update that won't work. Of course I don't have to do it, but... that's kinda hokey.

    P.S. The iOS and Android CS package update went just fine.

    Monday, January 26, 2015 4:26 PM
  • User68494 posted

    Hey Sherman

    Could not install package 'CocosSharp.MacOS 1.3.1.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.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.

    Try changing you target framework to v4.0

    Monday, January 26, 2015 5:32 PM
  • User68584 posted

    @kjpou1

    Ah! Thanks. I see. CocosSharp 1.3.1 is meant to continue working with classic Mac target (for Mac it continues to do stuff the non-unified way). I see that the Mac test suite (still classic) does indeed work with CS 1.3.1.

    So... uh... feeling kinda dumb here... how do I change the target framework to v4.0? I'm all over the preferences/options and I don't see it. Google isn't helping either. I'm not sure how it ended up at v4.5.

    Monday, January 26, 2015 6:11 PM
  • User68494 posted

    Open up your .csproj file and search for

    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>

    Change it to:

    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>

    Monday, January 26, 2015 6:41 PM
  • User68584 posted

    @kjpou1

    Hate to keep dragging this out... there was no target framework specification in the .csproj, so I added it to the first . After doing that, it did seem to change the target framework, but now, after updating to CS 1.3.1, I get:

    Could not install package 'CocosSharp.MacOS 1.3.1.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.0', 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.

    It doesn't like v4.0 either?

    I'm going to create a new Mac OS project from scratch and see if that works.

    Monday, January 26, 2015 7:06 PM
  • User68584 posted

    @kjpou1

    I'm going to create a new Mac OS project from scratch and see if that works.

    So... I'm really not having any luck with this. I made a brand new empty classic Mac OS project (entire solution, actually). It built and ran just fine, right out of the box. However, as soon as I added the CS 1.3.1 package:

    Could not install package 'CocosSharp.MacOS 1.3.1.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.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.

    Oh, v4.5 again... let me change that. So I go in and edit the .csproj to target v4.0, as before. The empty project still builds and runs fine. Add CS 1.3.1 package and:

    Could not install package 'CocosSharp.MacOS 1.3.1.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.0', 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.

    Just can't add the 1.3.1 package to a brand new empty classic Mac OS project. I feel like my Xamarin install is in some sort of "OK, you're now unified" state or more like some sort of "you're forever past using the v4.0 runtime" state.

    Just the fact that the target framework isn't exposed in the UI somewhere makes me wonder if it's enough to just specify it in the project file like that. In any case, I think it should just work (adding CS 1.3.1 to brand new classic Mac OS project).

    Monday, January 26, 2015 7:36 PM
  • User68584 posted

    @kjpou1

    I finally got it to work. The CS 1.3.1 Mac OS package is wrong. Although, if that's the case, I'm surprised that I'm the only one complaining about this. Am I the only CocosSharp Mac developer?!? Now I feel lonely. Maybe it's something else in combination with this.

    The target path in the Mac OS .nuspec was changed to "lib/Xamarin.iOS10" in commit e7154d0d0c030333ab4cab5e94fbde755779e033 on 1/16.

    I rebuilt the 1.3.1 package with the .nuspec target path set back to "lib/net40" and my Mac OS project now uses the 1.3.1 package without complaint.

    Monday, January 26, 2015 9:39 PM
  • User68494 posted

    @spotcatbug?

    Thanks for the catch. I have now modified this.

    https://github.com/mono/CocosSharp/issues/115 https://github.com/mono/CocosSharp/commit/7122b955007b2982ea140b34cf63be4b22253f89

    Tuesday, January 27, 2015 5:02 AM
  • User68494 posted

    Sherman

    I am often surprised, ever since the MonoGame days, that Mac is not targeted more often. So no you are not alone, I just always use source builds and think most people target mobile. Even on windows most of the problems reported are on WP8. We feel your loneliness as well :-)

    When I did the tests I used the Mac PCL NuGet which is correctly built to target lib/net40 for Mac projects which did not catch the error you reported.

    Again thanks for the catch and letting us know.

    Tuesday, January 27, 2015 5:17 AM
  • User68877 posted

    I'm interested in creating a Mac version of my game but as a struggling indie developer I could only just about afford the iOS and Android licenses - at the moment I can't justify a Mac license although I'd dearly love one :wink: as the Mac is my development workhorse.

    Tuesday, January 27, 2015 10:15 AM
  • User47368 posted

    Hi Sherman?,

    Just an update that new Mac NuGets have been pushed that should now correctly be installed when targeting Classic Mac projects. Thanks again for picking this up.

    Thursday, January 29, 2015 9:26 AM
  • User259633 posted

    I am looking to develop a game using cocossharp targetting mac. When i am trying to add nuget packages, cocossharp packages are failing to add with the following error.

    Could not install package 'CocosSharp 1.7.1'. You are trying to install this package into a project that targets 'Xamarin.Mac,Version=v2.0', 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.

    Could someone explain which is the right package or if there was a versioning problem that i am hitting into here.

    I also noticed the - http://mono.github.io/CocosSharp/ where I see an issue "#371 CCGameView: Add Mac support" marked to be part of the next release. Does that mean, Cocossharp is currently not supported on Mac?

    Thursday, September 22, 2016 11:18 PM