Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converting a project to PCL that depends on WebSocket4Net #70

Open
ikbenben opened this issue Dec 14, 2016 · 4 comments
Open

Converting a project to PCL that depends on WebSocket4Net #70

ikbenben opened this issue Dec 14, 2016 · 4 comments

Comments

@ikbenben
Copy link

Hi there

I'm trying to convert the Pusher dotnet library, https://github.com/pusher-community/pusher-websocket-dotnet , to be PCL so that it can be used in a Xamarin project however I'm having trouble adding WebSocket4Net to the Pusher PCL library.

I get the following error

Could not install package 'WebSocket4Net 0.14.1'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile111', 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 know I need to have the Profile and Target frameworks match with WebSocket4Net and I'm good with keeping the same level of support but I'm not sure where to find that information in your repository. There are a number of different solution and project files so I'm a bit confused

Can you tell me which settings you are using so I can match them

thanks

@gcadmes
Copy link

gcadmes commented Dec 22, 2016

As far as I know, Websockts4Net uses the NETStandard.Library 1.6.1, netstarndard1.6 based PCL as opposed to a profile based PCL.

Have you converted Pusher to NETStandard based PCL yet? If so, reply with a snippet of your project.json file. I had a similar issue and my error was in the Frameworks section of the project.json file.... I was missing the imports section.

I'm not at work now so I can't demonstrate what it should look like.
Let me know

@ikbenben
Copy link
Author

ikbenben commented Dec 22, 2016

Thanks. I'm on Mac and don't seem to have netstandard1.6 available in the options dialog. I only have netstandard1.5. Any ideas how to get 1.6? Is there a reason you are not targeting a lower netstandard? Maybe that was your issue in the Framworks section?

{
  "dependencies": {
    "Microsoft.NETCore.Portable.Compatibility": "1.0.1",
    "NETStandard.Library": "1.6.1"
  },
  "frameworks": {
    "netstandard1.5": {}
  }
}

@ikbenben
Copy link
Author

ikbenben commented Jan 4, 2017

Hi @gcadmes , do you have any feedback? thanks

@gcadmes
Copy link

gcadmes commented Jan 5, 2017

My apologies for not getting back to you sooner. I was out over the holidays and just getting back...

Here is a snippet of my project.json file:

{
  "supports": {},
  "dependencies": {
    "NETStandard.Library": "1.6.0",
    "Newtonsoft.Json": "9.0.2-beta1",
    "WebSocket4Net": "0.15.0-beta6",
    "Websockets.Pcl": "1.1.9",
    "modernhttpclient": "2.4.2"

  },
  "frameworks": {
    "netstandard1.4": {
      "imports": "portable-net45+win8+wpa81+wp8"
    }
  }
}

Firstly, the reason I've referenced three different Websocket libraries is due to my research efforts in choosing a websocket library to wrap. Unfortunately, WebSocket4Net and WebSocketsPCL have TLS issues on Android, and WebSocketsPCL doesn't support SSL on iOS either.

Also, if you're using Xamarin.Forms, referencing ""Microsoft.NETCore.Portable.Compatibility": "1.0.1"" does not seem to work. This link helps explain that in more detail: https://xamarinhelp.com/dot-net-standard-pcl-xamarin-forms/

If you want to support UWP, then you'll have to change your 'netstandard1.5' to 'netstandard1.4'.
In case you haven't see this blog, it explains netstandard, much better than can.
https://blogs.msdn.microsoft.com/microsoft_press/2016/07/26/from-the-mvps-key-steps-in-developing-net-core-applications/

I hope this helps, let me know. I'll get back sooner next time now that I'm back in the office.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants