-
Notifications
You must be signed in to change notification settings - Fork 561
Description
The Android Example of the famous project AvaloniaUI cannot be run through dotnet run. After my efforts, I found that it was caused by SkipCompilerExecution=true in dotnet8.0.204/packs/Microsoft.Android.Sdk.Darwin/34.0.143/targets/Microsoft.Android.Sdk.AssemblyResolution.targets.
<Target Name="_ResolveAssemblies">...
<PropertyGroup>
<_AdditionalProperties>
_ComputeFilesToPublishForRuntimeIdentifiers=true
;SelfContained=true
;AppendRuntimeIdentifierToOutputPath=true
;ResolveAssemblyReferencesFindRelatedSatellites=false
;SkipCompilerExecution=true <!-- Hi There -->
;_OuterIntermediateAssembly=@(IntermediateAssembly)
;_OuterOutputPath=$(OutputPath)
;_OuterIntermediateOutputPath=$(IntermediateOutputPath)
</_AdditionalProperties>
<_AndroidBuildRuntimeIdentifiersInParallel Condition=" '$(_AndroidBuildRuntimeIdentifiersInParallel)' == '' ">true</_AndroidBuildRuntimeIdentifiersInParallel>
</PropertyGroup>cd samples/ControlCatalog.Android; dotnet run The following error will be reported:
/Users/jamlee/Installed/dotnet8.0.204/sdk/8.0.204/Microsoft.Common.CurrentVersion.targets(4793,5):
error MSB3030: Could not copy the file "obj/Debug/net8.0/Avalonia.Dialogs.dll" because it was not found.
[/Users/jamlee/Tmp/Avalonia/src/Avalonia.Dialogs/Avalonia.Dialogs.csproj::TargetFramework=net8.0]
Although this Android Example can be run on VisualStudio 2022, it cannot be run on dotnet run. After further exploration I was able to reproduce this problem simply:
git clone https://github.com/AvaloniaUI/Avalonia.git
cd src/Avalonia/src/Avalonia.Dialogs
# Compile successfully
dotnet build
# This compilation will fail
dotnet build /p:android-arm64 /p:_ComputeFilesToPublishForRuntimeIdentifiers=true /p:SelfContained=true /p:AppendRuntimeIdentifierToOutputPath=true /p:ResolveAssemblyReferencesFindRelatedSatellites=false /p:SkipCompilerExecution=true /p:_OuterIntermediateAssembly=obj/Debug/net8.0-android34.0/android-arm64/ControlCatalog.Android.dll /p:_OuterOutputPath=bin/Debug/net8.0-android34.0/android-arm64/ /p:_OuterIntermediateOutputPath=obj/Debug/net8.0-android34.0/android-arm64/
Failure error message
.....
Build FAILED.
/Users/jamlee/Installed/dotnet8.0.204/sdk/8.0.204/Microsoft.Common.CurrentVersion.targets(4793,5): error MSB3030: Could not copy the file "obj/Debug/net6.0/Avalonia.Dialogs.dll" because it was not found. [/Users/jamlee/Tmp/Avalonia/src/Avalonia.Dialogs/Avalonia.Dialogs.csproj::TargetFramework=net6.0]
0 Warning(s)
1 Error(s)
To reproduce this problem directly, you can execute it, refer to AvaloniaUI Compilation Document
git clone https://github.com/AvaloniaUI/Avalonia.git
dotnet workload install android ios wasm-tools
curl -sSL https://raw.githubusercontent.com/Samsung/Tizen.NET/main/workload/scripts/workload-install.sh | sudo bash
dotnet tool install --global Nuke.GlobalTool --version 6.2.1
nuke
cd samples/ControlCatalog.Android
dotnet run
To sum up, there are 2 questions?
- Why does skipping compilation delete the existing
obj/Debug/net6.0/Avalonia.Dialogs.dll? - Why did I not encounter an error like
dotnet runwhen 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?