0

I'm working on a xamarin forms (PCL) project (A basic customer care chat app which is meant to run on Android and iOS only) that has just two xaml pages, custom renderers and few dependencies. This project is meant to be implemented into another existing project (which I don't have access to its source code) such that an action would be binded to a button on the existing app to show a page on my own project.

There is need for me to share my chat project with my client's developer but without exposing my source codes, perhaps compiling to dll or nuget package that would be added to the existing project to access my project's functions and pages. I have searched through the xamarin forum and here on stackoverflow but can't seem to lay my hands on a solution.

Is this possible at all? If yes, what am I missing? If no, is there any better option to use?

Please do note that the chat app completely done, so I'm hoping perhaps there's a way I could directly convert the project to a Nuget package.

Thanks in anticipation!

phourxx
  • 591
  • 1
  • 4
  • 15
  • @Rudy's answer looks good for packaging/distributing your code. However, even if you distribute your code as a DLL or NuGet package, there is no way to prevent someone from decompiling it to discover the source. Yes there are obfuscation tools out there, but **nothing** will prevent a motivated party from picking apart the inner workings of your code. – Micah Switzer Jun 15 '18 at 17:33
  • I do understand that surely, but the DLL files fails the moment my chat app project directory gets moved, which means if I send the DLL files, it would fail on my client's machine – phourxx Jun 15 '18 at 19:37
  • And that is the intended behavior? Or is this a problem you're trying to solve? – Micah Switzer Jun 15 '18 at 22:49
  • Yes, it is a problem I'm trying to solve. But I seem to have found a solution to it by setting visual studio to build Nuget package from my project on build – phourxx Jun 16 '18 at 13:51

2 Answers2

0

If the host application is a Xamarin Forms one:

-Move your cross platform shared code into a PCL or .Net Standard (ContentPages, ContentViews, Classes).

-Move your Renderers and platform specific code to Android and iOs Class Libraries.

Your client will have to reference your first assembly (dll) in their XF assembly in order to instantiate/manipulate your views/classes and platform specifics one on their Back-end side (taking into account your renderers, effects, etc ...)

A lot of Xamarin Controls Libraries Open Source hosted on Github are working like that. For example this one: https://github.com/jamesmontemagno/Xamarin.Forms-PullToRefreshLayout

If the host application is a native application, take a look into Xamarin forms embedding

Rudy Spano
  • 1,379
  • 10
  • 13
  • Thanks for your response, my client application is a Xamarin forms one. Also, when I compile my chat project and import the generated dll files in respective "bin" folder into a different xamarin forms app, it did work but when I changed the location of my chat project directory, the imported DLLs failed with dependency errors – phourxx Jun 15 '18 at 19:34
0

Finally, I seem to solve the problem by enabling visual studio to build Nuget packages for the chat app project (summing up to 3 nuget packages) on project build.

Thanks @Rudy Spano and @Micah Switzer for your contributions

phourxx
  • 591
  • 1
  • 4
  • 15