Registration on the app failed (MAUI/Comet) - c#

Code: https://github.com/ToadallyAwesome2/ComettTest
So I am using Maui/Comet. I just want to run a sample project, but I get this error:
DEP0700: Registration of the app failed. [0x80073CF6]
AppxManifest.xml(33,27): error 0x80070003: Cannot install or update
package BF12F2F8-C129-4401-821A-69268F23ED72_9zz4h110yvjzm because the
splash screen image [appiconfgSplashScreen.png] cannot be located.
Verify that the package contains an image that can be used as a splash
screen for the application, and that the package manifest points to
the correct location in the package where this splash screen image can
be found.
Anyone knows what I can do? I tried making an assets folder with that png, but it didnt work.
UPDATE
Did what Gerard Versluis recommended and got the following error:
DEP0700: Registration of the app failed. [0x80080204] error 0xC00CE020:
App manifest validation error: The app manifest must be valid as per
schema: Line 26, Column 8, Reason: Het vereiste kenmerk
Square150x150Logo ontbreekt. CometApp1
translation: The required attribute Square150x150Logo is missing.
I notice that it keeps asking for the Square150x150Logo

This happens because of change in one of the previews. Long story short; we used to have an Assets folder for the Windows app, but not anymore. Since it's all in preview there wasn't a concern for backwards compatibility, but now this could occur.
It happens because you probably started a project earlier, with older templates, and are now trying to build against new preview bits. So in the templates the Assets folder is still mentioned, but is no long there.
The steps to take are also described in the preview 13 migration guide.
Go into the Platforms\Windows folder and open the Package.appxmanifest file. Right-click > Open With... and choose the XML editor
Remove all references to Assets\
Double-check your App.xaml file to see if there is a windows:Application.ImageDirectory attribute on the Application node. If so, remove it. For example:
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:windows="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.WindowsSpecific;assembly=Microsoft.Maui.Controls"
windows:Application.ImageDirectory="Assets"
x:Class="WeatherTwentyOne.App">
should now be
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WeatherTwentyOne.App">
After that, it should work again!
To make sure it doesn't happen again, make sure that you have the latest templates by running dotnet new -i Microsoft.Maui.Templates which should get you the latest templates that do not reference Assets anymore.

this was the only solution than worked for me:
https://developercommunity.visualstudio.com/t/mauiapp-cannot-run-on-windows/1670999
Pasted below:
Upgrading the maui templates using
dotnet new --install Microsoft.Maui.Templates::6.0.200-preview.13.2865
solves this issue when creating a new MAUI App.
It would be nice, if the process of upgrading VS could include updating the MAUI templates or maybe warn about the need to manually update 😃
In case of an existing MAUI App project - these changes worked for me:
remove all references to the ‘Assets\’ subfolder from the Platforms\Windows\Package.appxmanifest file
add a line about raw assets to the .csproj file in the ItemGroup that contains the MauiIcon, MauiSplashScreen, MauiImage, MauiFont tags:
<ItemGroup>
...
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>

delete your .vs/obj/bin/.csproj/.sln, and then dotnet new maui --force right inside that same folder. that fixed this issue for me, and this randomly happened to, but i think it was due to me updating some workloads. im also sure my project template was still on preview 9 lol. its always best to be on the latest template for each preview.
EDIT: if you modified your App.xaml/App.xaml.cs and/or MainPage.xaml/MainPage.xaml.cs, youre gonna need to save those so you can put them back. dotnet new maui will need to overwrite some things. unless you delete them, but theyre just things generated by the template. anything generated that you have modified, will need to be saved and updated.

Related

Could not locate .NET Core project. Assets were not generated

I just started learning C# a couple hours ago, but have since run into this error.
Ctrl + Shift + P
.NET:Generate Assets for Build and Debug
But when I click it, an error pops up bottom right of the window:
Could not locate .NET Core project. Assets were not generated.
Restarting VS Code solved the problem in my case.
This same thing started happening to me on my mac on vscode. For me, it was because I didn't add my dotnet project to my solution file after I created the solution file and project.
This is essentially how I created my project:
Create empty project folder mkdir RecipeApp && cd RecipeApp
Add Solution File to Project (uses the name of containing folder) dotnet new sln
Create Backend .NET API dotnet new webapi -o API
Then this is the part I forgot to do (which actually solved a few other problems I was having, like I couldn't use the CMD + . feature to auto import classes and assets etc, too):
Add the sub project to the solution file dotnet sln add API
After I added the API subproject to the solution file, I could open the main top level project folder in vscode, and everything started working again.
This issue could be because the launch.json, which ideally should have been populated with the necessary details isn't generated in case. This issue seems to be linked to Omnisharp. If you go through the issue, you understand the root cause more clearly. You may need to perform the steps mentioned in this comment to get around the issue. These steps involve re-configuring the C# extension inside of your VS Code instance.
Alternately, ensure that all the folders which the extensions uses have appropriate access.
If the issue is also involving task.json, take a look at this answer
In my way helped to change the folder name to a name without spaces.
What I recommend doing is pressing "Run" then start debugging, which should open up a launch.json. If you open it, it will have about 17 warnings and then you can delete the warnings. Then, you press f5, which will give you an option to open a tasks.json. Do that and configure all of the tasks for running your project and it should work.
for me it helped to open the project with opening project_name.csproj with vs-code instead of loading the folder
In my case I just uninstall the c# extension and reload the vscode, after I install again (The vscode will ask to install some assets and somethings that miss in the project too).
Changing extension path manually helped me

Azure functions fail when creating a blank/empty project in an existing solution

I upgrade to Visual Studio 2017 15.8.1 and am having issues creating an Azure function project. The project I am trying to create is through the template wizard, just a new V1 empty function project.
I receive the following error, which seems to be .net core related.
NETSDK1004 Assets file '\obj\project.assets.json' not
found. Run a NuGet package restore to generate this
file. FunctionApp1 C:\Program Files\dotnet\sdk\2.1.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets 198
Run a NuGet package restore to generate this file.
But my project file states:
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<AzureFunctionsVersion>v1</AzureFunctionsVersion>
</PropertyGroup>
Just to be clear, I do want a 4.6.1 project, not a core one.
I have looked at other answers to this issue but none resolve it. Package reinstall, dotnet restore etc. I get more errors if I select a different template (e.g. HTTP Trigger)
Any ideas?
I thought I had a solution to reboot, then open %temp% and delete all the temporary files in that folder. Then reboot again for good measure and it worked from a blank / empty project, but as soon as I try include this in another solution or move the project it fails.
Seems I have it working now and I'll leave this here in case anyone else has the same.
I did try many many things to resolve, but I believe the crux of my fix was to reboot, then open %temp% and delete all the temporary files in that folder. Then I rebooted again for good measure and it worked from a blank / empty project.
Well that wasted a chunk of my day. I had created a repo in git which had a space in the name. When cloned I ended up with an encoded view of the repo - i.e. a %20 for the space, which appeared in the folder path. Since this was just some demo work I had left it as is instead of tidying it up to a clean namespace.
Turns out if you have a %20 or some other encoded value in your path you will get the NETSDK1004 error. I hope this answer saves someone else some time!

Did not find new element in the hierarchy for item

I am trying to create a simple page for a Xamarin app but am completely unable to proceed with the most basic of steps. I check out the branch from the project repo, and attempt to add a new file. When I do so (Right clicking on folder, Add-> New Item->Content Page) I get this error:
It does actually create the .xaml file but not the .xaml.cs file to go with it. I first tried to manually create the cs file and associate it but ran into increasingly mysterious errors. Today I created them outside of VS before booting it up and both files are now present but with the dotted icon instead of a regular one and the cs file is not nested beneath the xaml file.
If I try to open my projitems file inside VS to make the association I am given the error "Specified method is not supported". If I choose to 'Open With', no screen ever pops up allowing me to choose. After this I closed down VS and edited the projitems file in notepad again and linked the xaml and cs file. This looked as though it worked but when I add it to the main TabbedPage with a simple Children.Add(new MyReviews()); it is not recognized -> The type or namespace name 'MyReviews' could not be found.
These error happen if I make my own branch based on the master or try to add a new file to the master directly. No one else in the project is having these errors.
The only thing I really did differently from the rest is try to get the emulator working for android which apparently has a lot of compatibility issues and requires older versions of the xamarin plugins. I was not able to do this and ended up uninstalling and reinstalling everything twice since I didn't touch the installer software the first time and everything stuck.
Is anyone able to help me debug these issues or know why I am encountering so many at every turn?
I've been in the exact same situation. As it turned out, the rest of my team had added Universal Windows Platform (UWP) support to their VS2017 install, and I hadn't. Running the Visual Studio Installer and adding UWP fixed this issue completely.
Of course, you might not need or want to include UWP support in any of your Xamarin apps (I didn't). It seems most likely that it's just one or two support assemblies that are mssing or wrong without the UWP support, but I haven't found the time or energy to figure out any more details.

'ApplicationName' and 'Hello' strings missing in 'Resource.String' in Xamarin.Forms

I had fully working Xamarin.Forms (Android and iOS). HAXM is running. Then I installed CocosSharp from nuget in my PCL project and both Android and iOS projects. iOS project works great but Android... not.
I have:
'Resource.String' does not contain a definition for `ApplicationName'
'Resource.String' does not contain a definition for `Hello'
I looked for a solution, but all I found is that I have to Clean the solution. I did. It didn't work. I even closed the Visual Studio, removed packages folder, removed all bin/obj projects. Opened VS, again cleaned solution (just in case), rebuilt. The same error.
How can I fix this? Should I manually add String.xml to the project? Really?!
Thanks for help
How can I fix this? Should I manually add String.xml to the project? Really?!
I made a demo and reproduced your problem. By opening the Resource.Designer.cs file I found that the following codes are automatically added to UpdateIdValues():
global::CocosSharp.Forms.Android.Resource.String.ApplicationName = global::CocosSharpDemo.Droid.Resource.String.ApplicationName;
global::CocosSharp.Forms.Android.Resource.String.Hello = global::CocosSharpDemo.Droid.Resource.String.Hello;
By commenting out/deleting these two lines of codes, the application builds and runs correctly.
Or, of course adding a strings.xml file with following codes to values folder also fix the problem:
<resources>
<string name="ApplicationName">your project name</string>
<string name="Hello">hello</string>
</resources>
I have opened an issue on the project's Github.

Installation of the application failed. XAP package signature is not valid or the WP manifest file is invalid.

I have a WP8 app that I need to build in 3 configurations (release, release(prepro), release(fake)). Each configuration point to a different server and has different app icons. I need to be able to have all the 3 build in the phone at the same time so my solution is that I have created 3 different WMAppManifest.xml files (with different guids and icon paths) and I copy the right one in a pre-build step. This works fine (Based on this article http://www.tonicodes.net/blog/using-different-wmappmanifest-files-for-release-and-debug-builds/).
I upgraded the app to WP81 Silverlight. There is an additional Package.appxmanifest file. So I created 3 different Package.appxmanifest files, setting the PhoneProductId attribute to the right guid and added a pre-build step to do the copying also for this file.
When I try to run the app in release(prepro) or release(fake), meaning different WMAppManifest.xml an Package.appxmanifest are copied to the project first, I get
Installation of the application failed. XAP package signature is not valid or the WP manifest file is invalid. Re-sign with valid signature and fix the manifest file.
Is there something other than PhoneProductId that I need to changed in the new Package.appxmanifest files to make work?
I had the same issue, and maybe i can help you out. this xap signature is not valid happens a lot when some of the "pictures" in the appxmanifest file are not actually in the project. i have deleted my splashscreen picture that caused this error, deleting it from the appxmanifest file solved it. Beside that for each package you have a new package id wich if you want to publish the app you get in the dev center after you register your alias.
And there is the publisher ID wich you will also get after reverving an app name, its in this format "CN=************".
And the most important, and that i think what you search for, you can not install the same app twice on one phone. i tried it and somehow it just dont work. I have an app from store, and i can not install the same from visual studio before i dont delete the one from store. That happened never before on 8.0
I found a really easy workaround. Just add "DEBUG" to the end of the current Package name in the Package.appxmanifest designer.
Then you can have the debug version deployed: just be sure to remove the "DEBUG" from the Package name before you submit to the Store.
Also, if you still have the WMAppManifest.xml file, likewise append "DEBUG" to the Display Name so that on your phone you can easily differentiate which is which.
Cheers.
I found I needed to:
Make the Package.appxmanifest Package > Identity > Name unique (as per #kjo4jc's answer)
Change the Package.appxmanifest mp:PhoneIdentity > PhoneProductId GUID to differ from the value used in the store.
The changed GUID also needed to be changed in wmappmanifest.xml Deployment > App > ProductID to match.
I've found this happens if you try to debug an app on a phone that already has a version of the app downloaded from the store.
The easiest way to fix is to unistall the app from your phone first.

Categories

Resources