builder.CodeMarkupApp<App> - No accessible extension method
Closed this issue · 10 comments
Hi idexus, starting a new Maui app project and can't resolve this. CodeMarkup.Maui was included as a nuget along with HotReloadKit, no luck.
the compile error:
'MauiAppBuilder' does not contain a definition for 'CodeMarkupApp' and no accessible extension method 'CodeMarkupApp' accepting a first argument of type 'MauiAppBuilder' could be found (are you missing a using directive or an assembly reference?)
My code in MauiProgram.cs:
using System;
using CommunityToolkit.Maui;
namespace ReloadTest
{
using CodeMarkup.Maui;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder.CodeMarkupApp<App>(HotReloadSupport.IdeIPs).UseMauiApp<App>().ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
}).UseMauiCommunityToolkit().UseMauiCommunityToolkitMediaElement();
/*builder.Services.AddSingleton<ListViewPageViewModel>();
builder.Services.AddSingleton<SecondPageViewModel>();
builder.Services.AddSingleton<KeypadViewModel>();
builder.Services.AddSingleton<ListViewPage>();
builder.Services.AddSingleton<SecondPage>();
builder.Services.AddSingleton<KeypadPage>();
Routing.RegisterRoute("details", typeof(NavigationDetailPage));
Routing.RegisterRoute("seconddetails", typeof(NavigationSecondDetailPage));*/
return builder.Build();
}
}
}
The using CodeMarkup; line should be before the namespace.
@tcsaddul Yea I've tried that, no luck. Any other ideas? I'm using Visual Studio Mac.
try to use 0.5.1-alpha nuget package
Thanks for the update - fixed that issue. Do I need to then manually add these lines to the csproj file? Seems I'm not getting the autogenerated classes generated. For example, I'm not getting the connection established message as the sample. Perhaps you could share a vanilla sample project running on pure nugets instead of referenced projects? Looks like a great project overall!
HotReloadKit connected - address: 127.0.0.1 port: 5088 server version: 0.5.0-beta guid: ac1f9bf5-b9ef-49c4-b600-f9b0f9db2f28
true Generated<ItemGroup>
<None Remove="Pages\Navigation\" />
</ItemGroup>
<ItemGroup>
<Compile Remove="$(CompilerGeneratedFilesOutputPath)/**/*.cs" />
<None Include="$(CompilerGeneratedFilesOutputPath)/CodeMarkup.Maui.Generator.Classes/**/*.cs" />
<None Include="$(CompilerGeneratedFilesOutputPath)/CodeMarkup.Maui.Generator.Extensions/**/*.cs" />
<None Include="$(CompilerGeneratedFilesOutputPath)/HotReloadKit.Generator/**/*.cs" />
</ItemGroup>
VS does not show generated files, if you are using VS for mac then yes, for VS for windows it is not necessary as you can see it in Analyzers tab
you can use this project:
I was able to fire up the vanilla project with the new updates and it worked well. Also integrated it into my current project as a single nuget and it works well. Is it possible to use a NavigationPage as the App MainPage instead of a Shell? If I do that, the reloading fails. Either way, great tool here. Thanks for releasing this!
Never mind, using the CodeMarkup.Maui.NavigationPage I was able to get the reload to work. Only thing is there is now no constructor to set the RootPage on your NavigationPage. I was able to just Push my RootPage, but not sure this is best practice. Thanks.
I'm glad you like the project.
NavigationPage Example:
Makes sense - thanks again. May I buy you a coffee? Do you have a link?