Reputation: 284
I have a Xamarin.Forms application. The project structure is somewhat more complex than in a regular Xamarin.Forms solution.
I have my platform-specific projects:
I have a .net standard library project for the .xaml page definitions:
I have a .net standard library project for the .xaml page base classes:
I have a PageBase class in MyApp.UI.Base. Let's say I have Login.xaml like this:
<?xml version="1.0" encoding="utf-8" ?>
<base:PageBase xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:base="clr-namespace:MyApp.UI.Base;assembly=MyApp.UI.Base" ...>
...
</base:PageBase>
The type in Login.cs is also correct:
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class Login : PageBase
{
// ...
}
When I compile the solution, I get the following error:
Cannot resolve Assembly or Windows Metadata file 'Type universe cannot resolve assembly: MyApp.UI.Base, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.'
This error seems totally wrong, I tried other solutions, like deleting the .vs folder or restoring nuget packages but none of them worked.
Can I not have base classes of xaml pages from different assemblies?
Upvotes: 2
Views: 1259
Reputation: 284
The problem was that the project MyApp.UI.Base was not referenced from the MyApp.UWP project. Adding a reference solved the issue. I guess the error was right, just not that exact.
Upvotes: 2