Why do I get an error CS0310 when using MvxWpfSetup<Core.App> as RegisterSetupType
I try to build my first app with MvvmCross, found pretty good explanations in this video put I get error CS0310 when I setup the App.xaml.cs file the way it is shown in the video, as well as it is on the example page of the MvvmCross project page.
using MvvmCross.Core;
using MvvmCross.Platforms.Wpf.Core;
using MvvmCross.Platforms.Wpf.Views;
namespace MvxStarter.Wpf
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : MvxApplication
{
protected override void RegisterSetup()
{
this.RegisterSetupType<MvxWpfSetup<Core.App>>();
}
}
}
I am using MvvmCross.Platforms.Wpf in version 8.0.1 and the error message is:
Error CS0310 'MvxWpfSetup<App>' must be a non-abstract type with a public parameterless
constructor in order to use it as parameter 'TMvxSetup' in the generic type or method
'MvxSetupExtensions.RegisterSetupType<TMvxSetup>(object, params Assembly[])'.
The core class library has .Net Core 5.0 as its target framework and the same goes for the WPF project.
Solution 1:
All the MvxSetup
derivatives were marked abstract in MvvmCross 8.
You need to create your own Setup
class:
public class Setup : MvxWpfSetup<App>
{
}
Then you can register that:
this.RegisterSetupType<Setup>();