Maui issues after changing namespace
yesterday I had the briliant idea of changing the name of my app because i made it open source and previously was just a "personal" name, but anyway the issue is that visual studio now says that doesnt recognise "Maui" "Application" "MainPage" etc this part mostly started to appear when i changed the namespace on the xaml files "x:Class" but before there were issues mainly this
I currently reversed the project to a commit ago but the issue persists, I am not sure why because i just changed the name after committing.
I tried AI to help but it repeats itself and nothing worked, i search for all instances of the previous name and and i had changed all, i cant clean and rebuild because it fails, i deleted .vs folder but i couldnt open the solution after had to open the project, but nothing made a difference.
another error i got was regarding the manifest for android but i dont really know what to do in there. any help would be appreciated
for reference https://github.com/Saleca/Invasion1DGame
I didnt clone from the site so i hope the main branch is working fine, but that main should be the one i am currently having issues after reversing the commit, the problem with the new name is on the branch "ChangeRootNamespace"
thanks either way
38 Replies
You know, MAUI is a diva. looking at your csproj I see two problems.
Resources\AppIcon\Icon.svg
should be lowercase -> Resources\AppIcon\icon.svg
Next up, DO NOT use the same file for the appicon and the splash, even if it's meant to be the same svg, copy it and save it accordingly to it's designated folder, AppIcon
for appicon and Splash
for splash icons, using the same file will likely result in an error - believe me, it cost me 2 hours of my life.by the way, i tried at first to change the name of the folder where the project was and I couldnt because it was beeing used by some application, at the time i thought was vs but now i try to delete the project folder to clone it but i cant because some program is using it, although now vs is closed.
i will try that, the lowercase, is it a rule?
Yes, a rule without an error-code.
I will have that in mind but currently i dont have the "Icon.svg" because i reversed to the main, but the issue persisted for some reason.
didnt notice that, thanks
were you able to run the project?
yes
i guess i currupted my project folder, i will try to clone again , for you you clone the branched "change name" and made the changes on the icon name and copied the file for the splash?
Also make sure your AndroidManifest stays correct, sometimes the auto generation messes things up, check if it like this:
Especiall the
android:icon
I wasted a lot of time finding errors like this, the error messages aren't helpful either ^^thanks i will just restart to try to delete the folder because it keeps saying that is in use. i'll be right back
To clean it, delete the
.vs
, and all bin
& obj
foldersI tried but i still have the same issue, i had android:icon="@mipmap/appicon" i deleted the "app" i changed the name of the svg file and copied for the splash and changed in the project file accordingly, i deleted the bin and obj folders and tried to clean but it fails and the same errors pop up as originaly, this after i deleted the project and cloned. even with the main that should not have the issue.. I think
Well, well, I could fork it and make a pr, so you see exactly the changes made
this is what i have when i clean now, i also changed the name of the project, in the manifest was with a space and on the project was without
if you dont mind, i am completely confused, i didnt mess with the targets, i dont know why would i have issues with them, yesterday i did run the restore but nothing changed
Just for the sake of it, comment out the windows target framework, repoen the solution and give it another try.
less errors but still
Severity Code Description Project File Line Suppression State Error XA1018 Specified AndroidManifest file does not exist: C:\Users\salgl\Documents\Code\VS\Invasion1DGame\Invasion1D\AndroidManifest.xml. Invasion1D C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.43\tools\Xamarin.Android.Common.targets 596
Make it look like this:
https://pastebin.com/0Yqapb50
Pastebin
net8. - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
looking at the properties other change i did was enabling R8 code shrinker
ok so thats for the main
i was on the other branch just now but i can go back again
ive done it, and failed. . i try restarting but its very odd. once i had similar issue but opening a project from .net7 to .net8 i basically end up copying all files one by one to a new project -.-
I forked you main and set the proj as described previously, it does build.
its not working... i did comment out the windows portion, i have less errors but the manifest "is missing" although i never saw the manifest at that location (main folder)
thanks. i am clueless to what the issue is.
Have you open the manifest file with the texteditor or the built-in vs editor?
I hate to say "it does work", but it does
https://pastebin.com/mpQq5mLM
Here's the manifest I built from
i opened the manifest with xml in vs
xD
That's correct
i tried to build with windows because it should work, before did, but it still doesnt work even with your fork, what the hell did i do with my computer
i mean says to ensure i target and run restore, i do but it fails and loops back, but the android manifest i also dont understand it says it doesnt exist on that location but thats not the location that is suposed to be, is it? and i am building for windows right now so why complaining about android manifest
God damn, change the line 15 on the csproj to
<ApplicationTitle>Invasion1DGame</ApplicationTitle>
btw is the android:icon still suposed to be icon rather than appicon? i tried both ways now, but the confusion arises due to the name of the icon svg file
That's fine, as in my pastebin
Sir, you have a PR
for me is the same yet, i even cloned your branch to a new folder but the issues are the same.
what buggs me is that my main should not have any issue as i commited with it working. this must be unrelated to the project itself, maybe i changed something while tryng to fix the change name branch and that changed something on VS or something similar i have no idea
I'm looking into it
It's a needle in a haystack
if this is the case maybe the project is not the way to fix this. i am considering re iinstaling VS but i have limited internet lol
this built!!
thanks man, what you did in this last commit other thank changing the name? i see you change th names as i had on the branch changerootnamespace but you did branch of the main right? in one sweep you did what i tried and fixed the issue
Yay, the main was the one I was working on, take a look at the latest commit:
https://github.com/Saleca/Invasion1DGame/commit/15fcfd3ed1bd54f2028ddd163cfc385133e5cd22
seems to me that difference is the manifests for android tisen and the windows, but specially the android has major changes, comparing it to my failed branch (root namespace change)
well again, thanks for saving my ass here