xamarin-forms-samples icon indicating copy to clipboard operation
xamarin-forms-samples copied to clipboard

The "nuget restore" command fails

Open MaksimZhukov opened this issue 4 years ago • 6 comments

Sample

This issue is related to the ToDo sample.

Description

The nuget restore ./Todo/Todo.sln command fails with new Mono version (6.12.0.140) on macOS 10.15 Catalina image with the following error:

/Users/runner/work/xamarin-forms-samples/xamarin-forms-samples/Todo/Todo.UWP/Todo.UWP.csproj : error MSB4057: The target "_IsProjectRestoreSupported" does not exist in the project.
/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/NuGetScratch/qxkilfkb.j5z.nugetrestore.targets(315,5): warning : Skipping restore for project '/Users/runner/work/xamarin-forms-samples/xamarin-forms-samples/Todo/Todo.UWP/Todo.UWP.csproj'. The project file may be invalid or missing targets required for restore. [/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/NuGetScratch/hczm5041.2wn.nugetinputs.targets]

Steps to Reproduce

I forked this repository and prepared the workflow file with steps to reproduce this issue. The nuget restore command passes successfully with 6.12.0.125 Mono version and fails with new version (6.12.0.140). Please find more details in this workflow run.

Expected Behavior

The nuget restore command passes successfully

Actual Behavior

The nuget restore command fails

MaksimZhukov avatar Jun 09 '21 17:06 MaksimZhukov

The issue can also be reproduced with Mono 6.12.0.147 (see the related workflow run). cc @davidbritch

MaksimZhukov avatar Jul 13 '21 10:07 MaksimZhukov

Any luck with dotnet restore or msbuild -t:restore?

davidbritch avatar Jul 13 '21 11:07 davidbritch

The dotnet restore command runs without errors, but skips restoring for Todo.iOS.csproj and Todo.Android.csproj project files and produces warnings with the similar message:

warning NU1503: Skipping restore for project '/Users/runner/work/xamarin-forms-samples/xamarin-forms-samples/Todo/Todo/Todo.Android/Todo.Android.csproj'. The project file may be invalid or missing targets required for restore. [/Users/runner/work/xamarin-forms-samples/xamarin-forms-samples/Todo/Todo.sln]

The msbuild -t:restore command restores packages successfully.

Workflow run

MaksimZhukov avatar Jul 15 '21 14:07 MaksimZhukov

Hello @davidbritch! Have you had a chance to take a look at it?

MaksimZhukov avatar Jul 21 '21 12:07 MaksimZhukov

Hello @davidbritch! We tried to run builds for other applications and unfortunately all of them (except 1) failed with mono 6.12.0.140 and 6.12.0.147. Please see build logs for the details.

It looks like this issue is mostly related to the mono. We created an issue in the mono/mono repository, please take a look.

MaksimZhukov avatar Aug 04 '21 16:08 MaksimZhukov

Hello @davidbritch. We investigated an issue deeper and looks like it's related to Todo.UWP project.

Looking at the package restore logs for build with repro (https://github.com/nikolai-frolov/xamarin-forms-samples/actions/runs/1363166336), we found that both "nuget restore" and "msbuild /t:restore" for all Mono versions can't restore packages for Todo.UWP.csproj but difference is following:

  • "nuget restore" for Mono 6.12.0.125 throws neither warning nor error
  • "msbuild /t:restore" for all Mono versions throws warning
  • "nuget restore" for Mono 6.12.0.140+ throws a terminating error which fails our builds

@davidbritch could you please take a look at the package restoring for Todo.UWP.csproj?

nikolai-frolov avatar Oct 22 '21 15:10 nikolai-frolov