Generates ViewBase classes for UWP/Uno projects. ⭐ Last 10 features: - feat: To steps. 2023-03-10 - feat: Removed ReactiveUI support. 2023-02-06 - feat: Added ViewBaseGenerator_IsGeneric setting. 2022-08-22 - feat: Added ViewBaseGenerator_IsAbstract setting. 2022-08-22 - feat: Added ViewBaseGenerator_AddViewModelDependencyProperty setting. 2022-08-22 - feat: Added ConstructorGenerator.InheritFromViewBase. 2022-07-20 - feat: Lowered dotnet version requirements to run the generator. 2022-07-13 - feat: Added auto-detection BaseClass by platform. 2022-07-08 - feat: Added ability to setup ViewModel in constructor generators. 2022-07-08 - feat: Added ViewBaseGenerator_CreateReactiveUIWhenActivated. 2022-06-28 🐞 Last 10 bug fixes: - fix: Fixed ViewBaseGenerator explicit type bug. 2022-08-22 - fix: Fixed metadata bug. 2022-08-22 - fix: Updated H.Generators.Extensions. 2022-08-22 - fix: Splitted settings for generators. 2022-07-13 - fix: Changed prefix for base class to Controls. 2022-07-08 - fix: Fixed base class bug. 2022-07-08 - fix: Added global prefix to viewBase.BaseClass. 2022-07-08 - fix: Fixed PropertyMetadata bug. 2022-07-08 - fix: Added GenerateViewBase setting. 2022-07-08 - fix: Fixed constructor generation. 2022-07-01
$ dotnet add package ViewBaseGeneratorInstall-Package ViewBaseGenerator
<PropertyGroup>
<ViewBaseGenerator_Namespace>YourNamespace.Views</ViewBaseGenerator_Namespace>
</PropertyGroup>
<ItemGroup Label="ViewBase">
<AdditionalFiles Include="..\..\shared\YourNamespace.Shared\Views\**\*.xaml.cs" ViewBaseGenerator_BaseClass="ReactiveUI.Uno.ReactiveUserControl" ViewBaseGenerator_ViewModelNamespace="YourNamespace.ViewModels" Visible="False" />
</ItemGroup>
Uno uses Source Generators and there is currently no way to use the output of one generator in another. Therefore, the solution is somewhat more complicated:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0-android;net6.0-ios;net6.0-macos;net6.0-maccatalyst</TargetFrameworks>
</PropertyGroup>
<PropertyGroup>
<ViewBaseGenerator_Namespace>YourNamespace.Views</ViewBaseGenerator_Namespace>
</PropertyGroup>
<ItemGroup Label="ViewBase">
<AdditionalFiles Include="..\..\shared\YourNamespace.Shared\Views\**\*.xaml.cs" ViewBaseGenerator_BaseClass="ReactiveUI.Uno.ReactiveUserControl" ViewBaseGenerator_ViewModelNamespace="YourNamespace.ViewModels" Visible="False" />
<AdditionalFiles Remove="..\..\shared\YourNamespace.Shared\Views\Navigation\MainView.xaml.cs" />
<AdditionalFiles Include="..\..\shared\YourNamespace.Shared\Views\Navigation\MainView.xaml.cs" ViewBaseGenerator_BaseClass="ReactiveUI.Uno.ReactivePage" ViewBaseGenerator_ViewModelNamespace="YourNamespace.ViewModels" Visible="False" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ViewBaseGenerator" Version="1.3.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<!-- Your base class library -->
<PackageReference Include="ReactiveUI.Uno" Version="16.2.6" />
</ItemGroup>
<ItemGroup>
<!-- Your core project that contains ViewModels -->
<ProjectReference Include="..\YourNamespace.Core\YourNamespace.Core.csproj" />
</ItemGroup>
</Project>