Hi, I'm facing Issue Maui project Shows Route Issue but Project Running fine. My Project Was .Net Angular Seprated The Developer Menu Save Function not working.[Where ever I use File type same problem]
Power Tool Navigation Property I choose Dropdown or Typeahead Error. LookupTable Working Fine.
If you want I'll share my code.
Error: The type 'Pages' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
8 Answer(s)
-
0
Hello?
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hi @stanley5389
You need to add the
[Area("App")]attribute to your controller to fix the file upload issue.Example:
[Area("App")] [AbpMvcAuthorize(AppPermissions.Pages_Developers)] public class DevelopersController : ExcelImportControllerBase { // ... }Without this, the route will not match and you'll get a 404 error when uploading files.
The error
XL50414: The type 'Pages' was not foundmeans that the type you're referring to in your XAML is not correctly defined or referenced. Specifically, this line:ComponentType="{x:Type local:Pages_Routes}"is causing the issue.
To fix this:
Make sure
Pages.Routesis a valid class that is:public- Not
partialwithout implementation - Exists in the namespace
CoreSync.Maui(if you're usingclr-namespace:CoreSync.Maui).
If
Routesis in another namespace likeCoreSync.Maui.Pages, update your XAML accordingly:
xmlns:pages="clr-namespace:CoreSync.Maui.Pages" ... ComponentType="{x:Type pages:Routes}"MainPage.xml
<?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:CoreSync.Maui" xmlns:pages="clr-namespace:CoreSync.Maui.Pages" x:Class="CoreSync.Maui.MainPage" BackgroundColor="{DynamicResource PageBackgroundColor}"> <BlazorWebView x:Name="BlazorWebView"> <BlazorWebView.RootComponents> <RootComponent Selector="#app" ComponentType="{x:Type pages:Routes}" /> </BlazorWebView.RootComponents> </BlazorWebView> </ContentPage>The file upload issue you mentioned is not a problem in the latest version. If any errors are encountered after a detailed review, we will create an issue. Thank you for your feedback. If the issue persists, please feel free to contact us.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Thanks for the update. Works. If I add [Area("App")] Angular project throws permission error this method GetFileAllowedTypes()
If I remove [Area("App")] this working fine
using Abp.AspNetCore.Mvc.Authorization; using Abp.BackgroundJobs; using Abp.IO.Extensions; using Abp.UI; using Abp.Web.Models; using CoreSync.Authorization; using CoreSync.DataImporting.Excel; using CoreSync.Property; using CoreSync.Storage; using CoreSync.Storage.FileValidator; using CoreSync.Web.Controllers; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System; using System.IO; using System.Linq; using System.Threading.Tasks;
namespace CoreSync.Web.Controllers; [Area("App")] [AbpMvcAuthorize(AppPermissions.Pages_Addresses)] [Authorize] public class AddressesController : ExcelImportControllerBase { private readonly ITempFileCacheManager _tempFileCacheManager;
private const long MaxFileLength = 5242880; //5MB private const string MaxFileLengthUserFriendlyValue = "5MB"; //5MB private readonly string[] AllowedFileTypes = { "jpeg", "jpg", "png", "pdf" }; protected readonly IBinaryObjectManager _binaryObjectManager; protected readonly IBackgroundJobManager _backgroundJobManager; public override string ImportExcelPermission => AppPermissions.Pages_Addresses_Create; private readonly IFileValidatorManager _fileValidatorManager; public AddressesController(ITempFileCacheManager tempFileCacheManager, IBinaryObjectManager binaryObjectManager, IBackgroundJobManager backgroundJobManager, IFileValidatorManager fileValidatorManager) : base(binaryObjectManager, backgroundJobManager, fileValidatorManager) { _tempFileCacheManager = tempFileCacheManager; _fileValidatorManager = fileValidatorManager; } public FileUploadCacheOutput UploadFile() { try { //Check input if (Request.Form.Files.Count == 0) { throw new UserFriendlyException(L("NoFileFoundError")); } var file = Request.Form.Files.First(); if (file.Length > MaxFileLength) { throw new UserFriendlyException(L("Warn_File_SizeLimit", MaxFileLengthUserFriendlyValue)); } var fileType = Path.GetExtension(file.FileName).Substring(1); if (AllowedFileTypes != null && AllowedFileTypes.Length > 0 && !AllowedFileTypes.Contains(fileType)) { throw new UserFriendlyException(L("FileNotInAllowedFileTypes", AllowedFileTypes)); } var validationResult = _fileValidatorManager.ValidateAll(new FileValidateInput(file)); byte[] fileBytes; using (var stream = file.OpenReadStream()) { fileBytes = stream.GetAllBytes(); } var fileToken = Guid.NewGuid().ToString("N"); _tempFileCacheManager.SetFile(fileToken, new TempFileInfo(file.FileName, fileType, fileBytes)); return new FileUploadCacheOutput(fileToken); } catch (UserFriendlyException ex) { return new FileUploadCacheOutput(new ErrorInfo(ex.Message)); } } public string[] GetFileAllowedTypes() { return AllowedFileTypes; } public override async Task EnqueueExcelImportJobAsync(ImportFromExcelJobArgs args) { await BackgroundJobManager.EnqueueAsync<ImportAddressesToExcelJob, ImportFromExcelJobArgs>(args); }}
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hello, Can you give an Update ASAP. Thanks.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hi @stanley5389
You need to edit the endpoint on the Angular side. Here, when sending a request, add the
"/app"area name on prefix after theserviceBaseUrl.I will open a fix issue for this situation, so there will be no need to fix them manually in the next version.
Thank You.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
-
0
Hi @stanley5389
As shown in the screenshot below, removing the
"app/"part in theUploadFilemethod insideProxyDevelopersControllerServiceon the MAUI side will resolve your file upload issue. In fact, no changes will be needed in theDevelopersControlleron the backend. This will also make the previous suggestion unnecessary.So the updated code will be like this.
ProxyDevelopersControllerService.cs
public class ProxyDevelopersControllerService : ProxyAppServiceBase { public async Task<FileUploadCacheOutput> UploadFile(Stream stream, string fileName) { return await ApiClient.PostMultipartAsync<FileUploadCacheOutput>( "Developers/" + nameof(UploadFile), stream, fileName ); } }DevelopersController.cs
[Authorize] public class DevelopersController : ExcelImportControllerBase { //... }Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Perfect. Works. Thanks.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)







