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.76k stars 706 forks source link

`The value "/**/*" of the "Include" attribute in element <ItemGroup> in file .nuget\packages\uno.sdk\5.2.161\targets\Uno.SingleProject.Desktop.targets` #17297

Open xperiandri opened 2 months ago

xperiandri commented 2 months ago

Current behavior

Build error with:

The value "/**/*" of the "Include" attribute in element <ItemGroup> in 
file ".nuget\packages\uno.sdk\5.2.161\targets\Uno.SingleProject.Desktop.targets (33,25)" is a wildcard 
that results in enumerating all files on the drive, which was likely not intended. Check that referenced 
properties are always defined and that the project and current working directory are not at the drive root.

Expected behavior

Restore works

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

No response

Workaround

Go to Uno.SingleProject.Desktop.targets file and modify lines https://github.com/unoplatform/uno/blob/57abfeaad51a495fa7512a19eec407bf77cd0739/src/Uno.Sdk/targets/Uno.SingleProject.Desktop.targets#L33-L34

to remove the forward slashes

Works on UWP/WinUI

Yes

Environment

Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia

NuGet package version(s)

5.2.161

Affected platforms

Skia (WPF), Skia (Linux X11), Skia (macOS), Skia (Linux Framebuffer), Skia (GTK)

IDE

Visual Studio 2022

IDE version

17.10.3

Relevant plugins

No response

Anything else we need to know?

https://github.com/unoplatform/uno/blob/57abfeaad51a495fa7512a19eec407bf77cd0739/src/Uno.Sdk/targets/Uno.SingleProject.Desktop.targets#L33-L34 look wrong as

https://github.com/unoplatform/uno/blob/57abfeaad51a495fa7512a19eec407bf77cd0739/src/Uno.Sdk/targets/Uno.Common.targets#L53 already contains a slash

jeromelaban commented 2 months ago

Thanks for the report. Can you provide a repro?

xperiandri commented 2 months ago

Unless I give you my production solution I have no idea how to reproduce it. But, even so, the leading slash in those MSBuild properties is definitely wrong. As if the variable becomes "" it will do very wrong things

jeromelaban commented 2 months ago

Why would DesktopProjectFolder be empty? Are you changing its value explicitly?

xperiandri commented 2 months ago

Hypothetically. I just deducting why MS never prepened paths with slash but append variables

xperiandri commented 2 months ago

Really I don't know how this error appeared but it had…

jeromelaban commented 2 months ago

If the path is empty, this will cause all sorts of other issues, such as including all files from the root of the project, which is not the intent of that line. If you can provide a binlog of the issue, it will still help.

xperiandri commented 2 months ago

Here it is desktop.zip

jeromelaban commented 2 months ago

Thanks. This is a very curious behavior and feels very familiar to https://github.com/dotnet/msbuild/issues/9351. Could you try moving your project to a very small path and see if it reproduces?