NuGet / Home

Repo for NuGet Client issues
Other
1.5k stars 252 forks source link

Nuget restore doesn't work with msbuild 16 on mono #9222

Open helviett opened 4 years ago

helviett commented 4 years ago

Details about Problem

On MacOS nuget.exe version 5.4, 5.3.1, 5.2 etc.

mono nuget.exe restore -MSBuildPath /path/to/msbuild16v or /path/to/vstool/that/use/msbuild16. Using nuget without mono provides the same result.

Works with msbuild 15 or 14.

Verbose Logs

nuget restore Launcher.Mac.sln -MSBuildPath "/Library/Frameworks/Mono.framework/Versions/Current/Commands" -Verbosity detailed

Using Msbuild from '/Library/Frameworks/Mono.framework/Versions/Current/Commands'.
NuGet Version: 5.2.0.6090
Error parsing solution file at /Users/gameforest/dev/Citrus/Orange/Launcher/Launcher.Mac.sln: Invalid Image
NuGet.CommandLine.CommandLineException: Error parsing solution file at /Users/gameforest/dev/Citrus/Orange/Launcher/Launcher.Mac.sln: Invalid Image
  at NuGet.CommandLine.MsBuildUtility.GetAllProjectFileNamesWithMsBuild (System.String solutionFile, System.String msbuildPath) [0x000a1] in <86071b8d89ed441c8bd0686989227b79>:0
  at NuGet.CommandLine.MsBuildUtility.GetAllProjectFileNames (System.String solutionFile, System.String msbuildPath) [0x00021] in <86071b8d89ed441c8bd0686989227b79>:0
  at NuGet.CommandLine.RestoreCommand.ProcessSolutionFile (System.String solutionFileFullPath, NuGet.CommandLine.RestoreCommand+PackageRestoreInputs restoreInputs) [0x00056] in <86071b8d89ed441c8bd0686989227b79>:0
  at NuGet.CommandLine.RestoreCommand.GetInputsFromFile (System.String projectFilePath, NuGet.CommandLine.RestoreCommand+PackageRestoreInputs packageRestoreInputs) [0x00072] in <86071b8d89ed441c8bd0686989227b79>:0
  at NuGet.CommandLine.RestoreCommand.DetermineRestoreInputsAsync () [0x00080] in <86071b8d89ed441c8bd0686989227b79>:0
  at NuGet.CommandLine.RestoreCommand.ExecuteCommandAsync () [0x000be] in <86071b8d89ed441c8bd0686989227b79>:0
  at NuGet.CommandLine.Command.Execute () [0x000ea] in <86071b8d89ed441c8bd0686989227b79>:0
  at NuGet.CommandLine.Program.MainCore (System.String workingDirectory, System.String[] args) [0x001c1] in <86071b8d89ed441c8bd0686989227b79>:0

System details

=== Visual Studio Community 2019 for Mac ===

Version 8.3.10 (build 2) Installation UUID: 7bd83e47-a735-4ff0-89ea-d6d6c4bb5bfe GTK+ 2.24.23 (Raleigh theme) Xamarin.Mac 5.16.1.24 (d16-3 / 08809f5b)

Package version: 604000208

=== Mono Framework MDK ===

Runtime: Mono 6.4.0.208 (2019-06/07c23f2ca43) (64-bit) Package version: 604000208

=== NuGet ===

Version: 5.3.0.6192

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/3.0.100/Sdks SDK Versions: 3.0.100 2.1.700 2.1.505 2.1.504 2.1.302 MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.4.0/lib/mono/msbuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet Runtime Versions: 3.0.0 2.1.13 2.1.11 2.1.9 2.1.8 2.1.2

=== Xamarin.Profiler ===

Version: 1.6.12.29 Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Apple Developer Tools ===

Xcode 11.2 (15526) Build 11B52

=== Xamarin.Mac ===

Version: 6.6.0.12 (Visual Studio Community) Hash: e3c2b406d Branch: xcode11.2 Build date: 2019-11-01 00:12:07-0400

=== Xamarin.iOS ===

Version: 13.6.0.12 (Visual Studio Community) Hash: e3c2b406d Branch: xcode11.2 Build date: 2019-11-01 00:12:08-0400

=== Xamarin.Android ===

Version: 10.0.6.2 (Visual Studio Community) Commit: xamarin-android/d16-3/c407838 Android SDK: /Users/gameforest/Library/Developer/Xamarin/android-sdk-macosx Supported Android versions: 4.4 (API level 19) 4.4.87 (API level 20) 5.0 (API level 21) 5.1 (API level 22) 6.0 (API level 23) 7.0 (API level 24) 7.1 (API level 25) 8.0 (API level 26) 8.1 (API level 27)

SDK Tools Version: 26.1.1 SDK Platform Tools Version: 27.0.1 SDK Build Tools Version: 27.0.3

Build Information: Mono: mono/mono/2019-06@476d72b9e32 Java.Interop: xamarin/java.interop/d16-3@5836f58 LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94 LibZip: nih-at/libzip/rel-1-5-1@b95cf3fd ProGuard: xamarin/proguard/master@905836d SQLite: xamarin/sqlite/3.27.1@8212a2d Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3@cb41333

=== Microsoft Mobile OpenJDK ===

Java SDK: /Users/gameforest/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_8.0.25 1.8.0-25 Android Designer EPL code available here: https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 1.4.0.65 Hash: c33b107 Branch: remotes/origin/d16-3 Build date: 2019-11-19 20:33:22 UTC

=== Android Device Manager ===

Version: 1.2.0.116 Hash: d2b2af0 Branch: remotes/origin/d16-3 Build date: 2019-11-19 20:33:42 UTC

=== Xamarin Inspector ===

Version: 1.4.3 Hash: db27525 Branch: 1.4-release Build date: Mon, 09 Jul 2018 21:20:18 GMT Client compatibility: 1

=== Xamarin Designer ===

Version: 16.3.0.256 Hash: 8a223bfd7 Branch: remotes/origin/d16-3 Build date: 2019-11-01 21:02:02 UTC

=== Build Information ===

Release ID: 803100002 Git revision: add3a4998a5cb5b081e0404e1fe13acfecb7801d Build date: 2019-11-20 13:35:15+00 Build branch: release-8.3 Xamarin extensions: 79c69708816813b498283eeda7bcb4d464433a04

=== Operating System ===

Mac OS X 10.14.5 Darwin 18.6.0 Darwin Kernel Version 18.6.0 Thu Apr 25 23:16:27 PDT 2019 root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64

nkolev92 commented 4 years ago

Hey @KeltarHelviett Does any version of NuGet.exe work with msbuild 16 on mono?

helviett commented 4 years ago

Hey @KeltarHelviett Does any version of NuGet.exe work with msbuild 16 on mono?

We have tried several versions (5.x, 3.x). None of them worked with msbuild 16 on mono.

helviett commented 4 years ago

@nkolev92 Are there any changes?

nkolev92 commented 4 years ago

cc @rrelyea

helviett commented 4 years ago

@nkolev92 A month has passed. Are there any changes?

nkolev92 commented 4 years ago

Hey @KeltarHelviett

We are prioritizing issues that have high customer impact and we haven't seen too many reports of this problem.

Have you considered using dotnet.exe, as it's the preferred way for managing your .NET Core projects on Linux & Mac.

kartheekp-ms commented 4 years ago

Have you considered using dotnet.exe, as it's the preferred way for managing your .NET Core projects on Linux & Mac.

@KeltarHelviett - Please let us know your feedback regarding above suggestion to consider using dotnet.exe

helviett commented 4 years ago

Have you considered using dotnet.exe, as it's the preferred way for managing your .NET Core projects on Linux & Mac.

@KeltarHelviett - Please let us know your feedback regarding above suggestion to consider using dotnet.exe

We're using Xamarin.Mac 2.0.

erdembayar commented 3 years ago

Have you considered using dotnet.exe, as it's the preferred way for managing your .NET Core projects on Linux & Mac.

@KeltarHelviett - Please let us know your feedback regarding above suggestion to consider using dotnet.exe

We're using Xamarin.Mac 2.0.

We're asking have you tried something like dotnet restore or dotnet restore Yourpath\YourApp.csproj ? Please let us know.

helviett commented 3 years ago

dotnet restore doesn't work with Xamarin.Mac project.

aortiz-msft commented 3 years ago

@v-luzh - Would you please repro this on Mac using our latest bits?

v-luzh commented 3 years ago

@aortiz-msft It repro with msbuild 16 on mono. Not repro on default msbuild V15. Please refer to the discussion mail with Heng.

softlion commented 3 years ago

The issue is easy: the version of msbuild is hard coded to 14 and 15 for mono in NuGet.CommandLine MsBuildUtility.cs method GetMsBuildFromMonoPaths()

https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Clients/NuGet.CommandLine/MsBuildUtility.cs

And this nuget client has no env variable it could take instead to force the use of a more up-to-date version of msbuild.

An easy fix would be to read an env variable instead that would give the path of msbuild.

mos379 commented 2 years ago

any update here?

omatrot commented 2 years ago

Have you considered using dotnet.exe, as it's the preferred way for managing your .NET Core projects on Linux & Mac.

@KeltarHelviett - Please let us know your feedback regarding above suggestion to consider using dotnet.exe

@kartheekp-ms Using dotnet restore will work, but later on MSBuild will fail as per @softlion comment about hardcoded paths in the source code. This is incredible that is issue is not resolved yet.