Closed Jamlee closed 1 week ago
dotnet run
is not yet implemented you need to use dotnet <project> -t:Run -f net8.0-android
The dotnet team have only just added the support we needed to allow dotnet run
to work (see https://github.com/dotnet/android/pull/9470). So this will not be implemented until .net 10.
The chances are the default targets running when you run dotnet run
are running a design time build which is why things behave the way they do.
Anyway this should be resolved via https://github.com/dotnet/android/pull/9470
@dellis1972 Hi, Thanks for your help.
It seems that dotnet <project> -t:Run -f net8.0-android
didn't work properly either.
➜ ControlCatalog.Android git:(master) ✗ dotnet ControlCatalog.Android.csproj -t:Run -f net8.0-android
Could not execute because the specified command or file was not found.
Possible reasons for this include:
* You misspelled a built-in dotnet command.
* You intended to execute a .NET program, but dotnet-ControlCatalog.Android.csproj does not exist.
* You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
dotnet run
hasn't been implemented yet. But why is it that dotnet run
can start the simplest Android program? This is rather puzzling
dotnet new android
dotnet run
sorry
dotnet build <project> -t:Run -f net8.0-android
The current dotnet run
is a hack, it does not work 100% of the time in all projects.
PR https://github.com/dotnet/android/pull/9470 has the actual correct support. This was because of the way the dotnet team first implemented dotnet run
it made some assumptions which make android support a bit unstable/difficult.
The Android Example of the famous project AvaloniaUI cannot be run through
dotnet run
. After my efforts, I found that it was caused bySkipCompilerExecution=true
indotnet8.0.204/packs/Microsoft.Android.Sdk.Darwin/34.0.143/targets/Microsoft.Android.Sdk.AssemblyResolution.targets
.cd samples/ControlCatalog.Android; dotnet run
The following error will be reported:Although this Android Example can be run on
VisualStudio 2022
, it cannot be run ondotnet run
. After further exploration I was able to reproduce this problem simply:Failure error message
To reproduce this problem directly, you can execute it, refer to AvaloniaUI Compilation Document
To sum up, there are 2 questions?
obj/Debug/net6.0/Avalonia.Dialogs.dll
?dotnet run
when I right-clicked and ran the project in VisualStudio 2022? Is it because VisualStudio skipped compiling the compiled project?PS: The first language I learned twelve years ago was C#. Because it was not open source, there seemed to be too much witchcraft in it to confuse people. Now that it is open source, I want to figure out the problem. It took me five nights to find that
SkipCompilerExecution=true
was the root cause of the problem. If it is convenient, cloud you help me?