Closed roguedev1 closed 2 years ago
Hey there @roguedev1 thanks for the report! Unfortunately it doesn't contain enough info at this point to effectively diagnose what might be going on. Could you maybe elaborate a bit more on these points:
dotnet --version
tell you?Thanks!
cc: @Sweekriti91 for migration issues maybe?
Hi @roguedev1. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
Hey there @roguedev1 thanks for the report! Unfortunately it doesn't contain enough info at this point to effectively diagnose what might be going on. Could you maybe elaborate a bit more on these points:
Hi thanks for the reply. I have added the information below.
What type of project are you trying to convert? MonoGame Android Application (MonoGame Team)
What are the steps you are taking? A bit more precise than copying classes and NuGets
What NuGets are you using?
What version of Visual Studio are you using? Microsoft Visual Studio Community 2022 (64-bit) Version 17.3.3
Did you install the .NET MAUI workload when installing Visual Studio? Yes
What does running dotnet --version tell you? 6.0.400
There is a build error in release mode that mentions the package:
Precompiling failed for C:\Users\hidden\obj\Release\net6.0-android\android-x86\linked\Plugin.MauiMtAdmob.dll. Failed to load method 0x6000095 from 'C:\Users\hidden\obj\Release\net6.0-android\android-x86\linked\Plugin.MauiMtAdmob.dll' due to Could not load file or assembly 'Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.. Mono Ahead of Time compiler - compiling assembly C:\Users\hidden\obj\Release\net6.0-android\android-x86\linked\Plugin.MauiMtAdmob.dll AOTID 030115F2-9CB1-3D92-0052-0036762132E1 Using profile data file 'C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\32.0.448\targets\dotnet.aotprofile' Run with MONO_LOG_LEVEL=debug for more information. AOT of image obj\Release\net6.0-android\android-x86\linked\Plugin.MauiMtAdmob.dll failed. hidden C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\32.0.448\targets\Microsoft.Android.Sdk.Aot.targets 91
Does this ring any bells @jonathanpeppers
I think we need an MSBuild .binlog
to look into this more. So @roguedev1 could you dotnet build -bl
your project and share the msbuild.binlog
file?
Hi @roguedev1. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
@roguedev1 I had the same issue, here is how I fixed it:
Add <UseMaui>true</UseMaui>
to your .csproj. The UseMauiEssentials directive is insufficient and NuGet does not handle this prerequisite for you. You may also need this: https://github.com/marcojak/MauiMTAdmob/issues/2
Delete your bin
and obj
folders (a simple Clean operation didn't work for me, so this was necessary). Rebuild.
MAUI also changes how you deploy to your Android Emulator/Hardware (the debug deploy menu changes from a device list to a standard "Start" button and submenus to select target for deployment).
I have been unable to get this (choosing an android deployment target) to work. At first I could build/deploy to an emulator, but upon trying to change to a hardware device target, it simply did nothing and the emulator device kept the checkmark. I then deleted my .csproj.user file in an attempt to get it regen/fix it. Now, the deploy target is stuck on my hardware device (has the checkmark in menu) and can't be changed away from it (unless I disconnect my device), and when I attempt to build I get the error "Please select a valid device before running the application."
@roguedev1 does UseMaui=true
solve anything for you?
Hi @roguedev1. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
I have the same issue after updating VS from 17.3 to 17.4 prev2. Since than, it was working just fine.
Now I am getting an error error.txt
Project structure is not complex but having several MAUI / net standard libs. Only one library is affected (I4.Mobile.Droid.Controls) with that issue. I have tried to link a compiled affected library to the main project, however, other libs are affected either. Error is shown gradually one by one as each library is linked as dll instead as a project. This behavior is incl. Net standard 2.0 libs.
@I4-PJ I think your issue is the same as:
This is unrelated to this one, as the Could not load Microsoft.Maui.dll
message is different than one of your own assemblies.
Hi @roguedev1. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
I tried adding <UseMaui>true</UseMaui>
to my .csproj and it did not seem to make any difference.
Here is my build log:
Hi @roguedev1, somehow I missed checking back on this.
The build log above is minimal verbosity, so it doesn't have the info we need. If you ran dotnet build -bl
, can you share the msbuild.binlog
it created in the current directory?
If it is a sample project (C:\Users\abc_\source\repos\abc
) are you able to share the entire project? Thanks!
I've created a fresh project with the binlog: msbuild.zip
From the .binlog
, Project1.csproj
does not have <UseMaui>true</UseMaui>
. I don't think we have a way for NuGet packages to opt your project into using MAUI.
Is the GitHub repo public? The link shows a 404, which could mean it's private.
I changed it to public now
Yes sorry I made a fresh one without adding the extra line of code, although it made no difference when I tried before
When I add UseMaui=true
, the project gets past the Could not load Microsoft.Maui.dll
and hits errors about missing Java packages:
javac.exe error JAVAC0000: error: package com.google.android.ump.ConsentForm does not exist
Then I added the missing package:
<PackageReference Include="Xamarin.Google.UserMessagingPlatform" Version="2.0.0.2" />
I think that Plugin.MauiMTAdmob
should make this a dependency?
Does that get things working for you? The sample app crashes, asking for an API key now:
09-30 15:54:01.034 14279 14279 I MonoDroid: ******************************************************************************
09-30 15:54:01.034 14279 14279 I MonoDroid: * The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers *
09-30 15:54:01.034 14279 14279 I MonoDroid: * should follow the instructions here: *
09-30 15:54:01.034 14279 14279 I MonoDroid: * https://googlemobileadssdk.page.link/admob-android-update-manifest *
09-30 15:54:01.034 14279 14279 I MonoDroid: * to add a valid App ID inside the AndroidManifest. *
09-30 15:54:01.034 14279 14279 I MonoDroid: * Google Ad Manager publishers should follow instructions here: *
09-30 15:54:01.034 14279 14279 I MonoDroid: * https://googlemobileadssdk.page.link/ad-manager-android-update-manifest. *
09-30 15:54:01.034 14279 14279 I MonoDroid: ******************************************************************************
Thank you very much for the help @KelsamGames and @jonathanpeppers. I tried again and turns out I was editing the wrong file. I have a file called [projectname].csproj but this is a USER file. I was supposed to edit the [projectname] C# Project File.
Problem encountered on https://dotnet.microsoft.com/en-us/learn/maui/first-app-tutorial/install Operating System: Windows 10
I have installed VS 2022 and tried to migrate my project from VS 2019. However, when building the project I receive the following error message:
System.IO.FileNotFoundException: Could not load assembly 'Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken='.
Steps to Reproduce Create a new VS 2022 project Migrate classes and nuget packages from VS 2019 Build the app
Expected Behavior App runs without any issue
Actual Behavior Build failed error with this build log output: