unoplatform / uno

Build Mobile, Desktop and WebAssembly apps with C# and XAML. Today. Open source and professionally supported.
https://platform.uno
Apache License 2.0
8.77k stars 706 forks source link

Uno.UI.Tasks-related errors prevent Samples app build #14852

Open MartinZikmund opened 9 months ago

MartinZikmund commented 9 months ago

Current behavior

With Uno.UI cloned locally, various Uno.UI.Tasks erros prevent build:

Severity    Code    Description Project File    Line    Suppression State
Error   MSB4062 The "Uno.UI.Tasks.RuntimeAssetsSelector.RuntimeAssetsSelectorTask_v0" task could not be loaded from the assembly C:\Dev\uno2\src\SamplesApp\SamplesApp.Skia.Wpf\..\..\SourceGenerators\Uno.UI.Tasks\bin\Debug_Shadow\Uno.UI.Tasks.v0.dll. Could not load file or assembly 'file:///C:\Dev\uno2\src\SourceGenerators\Uno.UI.Tasks\bin\Debug_Shadow\Uno.UI.Tasks.v0.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. SamplesApp.Skia.Wpf C:\Dev\uno2\build\nuget\uno.winui.runtime-replace.targets   50  

Had to rebuild Uno.UI.Tasks and then manually rebuild the projects that were showing errors to make the samples app build again.

Expected behavior

Should build first try.

How to reproduce it (as minimally and precisely as possible)

  1. Create a clean clone of Uno.UI or run a full git clean on existing clone
  2. Set target framework to net7.0 and open skia-only slnf
  3. Try to run SamplesApp.Wpf

Workaround

Had to rebuild Uno.UI.Tasks and then manually rebuild the projects that were showing errors to make the samples app build again.

Works on UWP/WinUI

Yes

Environment

Uno.UI / Uno.UI.WebAssembly / Uno.UI.Skia, Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia

NuGet package version(s)

No response

Affected platforms

No response

IDE

No response

IDE version

VS 2022

Relevant plugins

No response

Anything else we need to know?

No response

jeromelaban commented 9 months ago

Related to https://github.com/unoplatform/uno/issues/14189. This looks like a mix of msbuild integration and ordering caused by design-time builds.

jeromelaban commented 9 months ago

running taskkill /f /im msbuild.exe and building uno.ui.tasks generally helps.

jeromelaban commented 6 months ago

This issue does not happen anymore.

MartinZikmund commented 5 months ago

Unfortuantely have to reopen this one, it has been happening often recently with:

MSB4062 The "Uno.UI.Tasks.ResourcesGenerator.UpriSubstitutionsGeneratorTask_v0" task could not be loaded from the assembly D:\Work\uno2\src\Uno.UI..\SourceGenerators\Uno.UI.Tasks\bin\Debug_Shadow\Uno.UI.Tasks.v0.dll. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

jeromelaban commented 5 months ago

I'm not able to reproduce this one. If you have a binlog you can provide it will help.

MartinZikmund commented 5 months ago

I did the following:

  1. Got the error
  2. Closed VS and done taskkill /f /im msbuild.exe -> no such processes found, so VS closed them correctly
  3. Rebuild Uno.UI.Tasks, got:

3>C:\Dev\Uno2\src\SourceGenerators\Uno.UI.Tasks\Uno.UI.Tasks.csproj(47,3): warning MSB3026: Could not copy "bin\Debug\Uno.UI.Tasks.v0.dll" to "bin\Debug\..\Debug_Shadow\Uno.UI.Tasks.v0.dll". Beginning retry 1 in 500ms. The process cannot access the file 'bin\Debug\..\Debug_Shadow\Uno.UI.Tasks.v0.dll' because it is being used by another process. The file is locked by: "MSBuild.exe (28116), MSBuild.exe (23972)" 3>C:\Dev\Uno2\src\SourceGenerators\Uno.UI.Tasks\Uno.UI.Tasks.csproj(47,3): warning MSB3027: Could not copy "bin\Debug\Uno.UI.Tasks.v0.dll" to "bin\Debug\..\Debug_Shadow\Uno.UI.Tasks.v0.dll". Exceeded retry count of 1. Failed. The file is locked by: "MSBuild.exe (28116), MSBuild.exe (23972)" 3>C:\Dev\Uno2\src\SourceGenerators\Uno.UI.Tasks\Uno.UI.Tasks.csproj(47,3): warning MSB3021: Unable to copy file "bin\Debug\Uno.UI.Tasks.v0.dll" to "bin\Debug\..\Debug_Shadow\Uno.UI.Tasks.v0.dll". The process cannot access the file 'bin\Debug\..\Debug_Shadow\Uno.UI.Tasks.v0.dll' because it is being used by another process.

  1. Rebuild solution and got lots of errors, bin log and build output attached here Bin.zip

In the end had to both reboot and git clean -xfd

lindexi commented 5 months ago

I fixed the build issues by the steps:

  1. Close all VisualStudio
  2. Run taskkill /f /im msbuild.exe
  3. Run dotnet build src\SourceGenerators\Uno.UI.Tasks\Uno.UI.Tasks.csproj
  4. Reopen the Uno.UI-Skia-only.slnf in VisualStudio
  5. Build the Uno.UI.Runtime.Skia.Wpf project