Caliburn-Micro / Caliburn.Micro

A small, yet powerful framework, designed for building applications across all XAML platforms. Its strong support for MV* patterns will enable you to build your solution quickly, without the need to sacrifice code quality or testability.
http://caliburnmicro.com/
MIT License
2.8k stars 778 forks source link

UWP Xamarin Forms application with Caliburn.Micro version 4.0.135-beta #707

Closed schovan closed 3 years ago

schovan commented 4 years ago

Hello, I would like to ask:

Edit: My scenario - one assembly uses Caliburn.Micro.Xamarin.Forms UWP, one assembly uses Caliburn.Micro WPF .Net Core, one shared assembly uses Caliburn.Micro.Core)

nigel-sampson commented 4 years ago

In the 4.x versions I've collapsed the Caliburn.Micro.Xamarin.Forms package back into the Caliburn.Micro package.

schovan commented 4 years ago

I'm not sure, if I understand you correctly. Do you mean that package Caliburn.Micro.Xamarin.Forms is included in package Caliburn.Micro version 4.0.135-beta? Because I cannot find there for example class Caliburn.Micro.Xamarin.Forms.FormsApplication

nigel-sampson commented 4 years ago

You can see it at https://github.com/Caliburn-Micro/Caliburn.Micro/blob/master/src/Caliburn.Micro.Platform/Platforms/Xamarin.Forms/FormsApplication.cs

schovan commented 4 years ago

Thank you, now I can find it. But unfortunatelly, my project is still not buildable. I have an UWP application that uses Xamarin Forms and Caliburn Micro. It works with previous implementation with standalone Caliburn.Micro.Xamarin.Forms version 4.0.0-alpha1. Now in Caliburn.Micro version 4.0.135-beta, it looks like that needed classes are in netstandard2.0\Caliburn.Micro.Platform.dll and uap10.0.16299\Caliburn.Micro.Platform.dll, only one of them can be loaded, not both. I'm getting an error at this line:

LoadApplication(new FormsApp(IoC.Get<SimpleContainer>()));

and the errors are:

error CS7069: Reference to type 'FormsApplication' claims it is defined in 'Caliburn.Micro.Platform', but it could not be found
error CS1503: Argument 1: cannot convert from 'CardGame.UWP.FormsApp' to 'Xamarin.Forms.Application'

Do you know some trick, how to make it working?

nigel-sampson commented 4 years ago

Ok, now I get you, let me look into it.

nigel-sampson commented 4 years ago

I don't think we're supporting Xamarin.Forms UWP with the project system. Right now its using the platform type like uwp / netstandard to work out which "flavour" of CM to use. In your case its assuming you want UWP, but what you want is XF on UWP.

Having XF solved this, but created long term problems in maintaining the package.

schovan commented 4 years ago

I do not understand. Previsously, it was working in 4.0.0-alpha1 version with the special package Caliburn.Micro.Xamarin.Forms. Combinations UWP + Xamarin Forms, Android + Xamarin Forms, iOS + Xamarin Forms was working. Now in version 4.0.135-beta, no combination is working. How can Xamarin Forms work in version 4.0.135-beta? Do you have some examples? What is the of purpose of Caliburn.Micro.Platform.dll type Xamarin.Forms (netstandard2.0)? What can it do without a second platform? Maybe I cannot see it, but it looks useless to me.

Edit: It looks like Caliburn.Micro.Platform.dll type netstandard2.0 is former Caliburn.Micro.Xamarin.Forms.dll type netstandard1.4. Problems would be solved if this assembly is renamed back to Caliburn.Micro.Xamarin.Forms.dll and can be referenced separatelly (no conflicts between different Caliburn.Micro.Platform)

Edit 2: Ok, I used your source code and built Caliburn.Micro.Platform, but renamed assembly name to Caliburn.Micro.Xamarin.Forms and all namespaces to Caliburn.Micro.Xamarin.Forms. Then I referenced netstandard2.0 output of it in my project (now my project uses both Caliburn.Micro.Platform.dll for UWP and my custom Caliburn.Micro.Xamarin.Forms.dll). And ..... it works! Will this be ever possible to do it automatically by nuget? I think people may want to use Caliburn Micro together with Xamarin Forms on UWP platform or other platforms. [And I would like to ask, why previous Caliburn.Micro.Xamarin.Forms system has been changed?]

nigel-sampson commented 4 years ago

The new build system doesn't allow dependent assemblies to be added to the automatically created packages. Previously I had a Caliburn.Micro.Platform.Core assembly that contained a lot of shared code between the Platform and Platform.Xamarin.Forms assemblies that shouldn't be its own package but it couldn't get bundled into that Platform package.

This meant maintaining the Xamarin.Forms package separately wasn't going to work. The UWP with Xamarin.Forms scenario you hit was the unintended conseuquence.

KasperSK commented 3 years ago

I think we could close this issue as it was fixed by #726.