Bug 47690 - [workbooks] NuGet error: package requires NuGet client version '2.12' or above, but the current NuGet version is '2.8.7.0'
Summary: [workbooks] NuGet error: package requires NuGet client version '2.12' or abov...
Status: RESOLVED FIXED
Alias: None
Product: Workbooks & Inspector
Classification: Xamarin
Component: Client: Cross Platform (Shared Code) ()
Version: 1.0.0
Hardware: PC Mac OS
: Normal normal
Target Milestone: 1.2
Assignee: xamarininteractive
URL:
: 47689 ()
Depends on:
Blocks:
 
Reported: 2016-11-23 05:29 UTC by CraigD
Modified: 2017-05-08 17:44 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Workbook that exhibits NuGet error (18.38 KB, text/plain)
2016-11-23 05:33 UTC, CraigD
Details
Workbook that succesfully runs (16.36 KB, text/plain)
2016-11-23 05:33 UTC, CraigD
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description CraigD 2016-11-23 05:29:44 UTC
Relates to sample https://github.com/xamarin/Workbooks/tree/master/csharp/roslyn/roslyn-syntax-trees.workbook

STEPS
-----

0. When this sample (above) was first created...
1. Add NuGet package Microsoft.CodeAnalysis.CSharp
2. This pulls in Microsoft.CodeAnalysis.Common which has a whole LOT of dependencies [see](https://www.nuget.org/packages/Microsoft.CodeAnalysis.Common/)
3. All these dependencies are included in the YAML header [see](https://github.com/xamarin/Workbooks/blob/71120728406a5a05667e9dae85792f617b827269/csharp/roslyn/roslyn-syntax-trees.workbook/index.workbook#L5-L89)
4. The workbook runs fine in this first session when the Nuget was added.
5. Subsequently opening the Workbook fails on Package Restore - error "The 'System.Text.Encoding.CodePages 4.3.0' package requires NuGet client version '2.12' or above, but the current NuGet version is '2.8.7.0'"


LOG
---
[Info][00:00:10.8669960] MessageViewController (LogMessage): PushMessage => Status: Restoring packages… @ /Users/builder/data/lanes/904/1f3067d3/source/inspector/Clients/Xamarin.Interactive.Client/Messages/MessageViewController.cs:98
[Error][00:00:16.7410970] MessageViewController (LogMessage): PushMessage => Alert: The 'System.Text.Encoding.CodePages 4.3.0' package requires NuGet client version '2.12' or above, but the current NuGet version is '2.8.7.0'. @ /Users/builder/data/lanes/904/1f3067d3/source/inspector/Clients/Xamarin.Interactive.Client/Messages/MessageViewController.cs:98


WORKAROUND
----------
If you manually delete all the dependencies from the YAML [see](https://github.com/xamarin/Workbooks/commit/54a3b4828b04eaa82d2b1fdf8fbf8b66ad56cd78) leaving ONLY 
```
 packages:
 - id: Microsoft.CodeAnalysis.CSharp
    version: 1.3.2
```
then the workbook opens, restores packages, and runs successfully every time. But when all the dependencies are included in the YAML, it fails with the error shown above.

The workbook that loads successfully is [here](https://github.com/xamarin/Workbooks/tree/master/csharp/roslyn/roslyn-syntax-trees.workbook).
Comment 1 CraigD 2016-11-23 05:33:03 UTC
Created attachment 18606 [details]
Workbook that exhibits NuGet error

Workbooks Version 1.0.0.0 (master/1f3067d)
Comment 2 CraigD 2016-11-23 05:33:28 UTC
Created attachment 18607 [details]
Workbook that succesfully runs
Comment 3 Miguel de Icaza [MSFT] 2016-11-23 14:08:00 UTC
Additionally: it would be nice if workbooks only listed the NuGet packages that have been added explicitly, and not the very very long list of nuget packages that results from adding this one package.
Comment 5 CraigD 2016-11-23 18:17:37 UTC
Another observation: if you open the "Workbook that successfully runs attachment 18607 [details]) and then save it on _Mac_ (El Cap), the YAML becomes:

```
---
uti: com.xamarin.workbook
platforms:
- Console
packages:
- id: System.Collections.Immutable
  version: 1.3.0
- id: System.Reflection.Metadata
  version: 1.4.1
- id: Microsoft.CodeAnalysis.Common
  version: 1.3.2
- id: Microsoft.CodeAnalysis.CSharp
  version: 1.3.2
---
```

...and not the complete/full list of 20+ dependencies that were added when  `Microsoft.CodeAnalysis.CSharp` was referenced on Windows, so I think this is a Mac/Windows difference. On Windows if I save it, the full list is re-added to the YAML and it re-opens without error.

SO - addendum to the original report:
* NuGet behavior is different on Mac and Windows! Mac pulls in 4 dependencies, Windows pulls in 20
Comment 6 Rajneesh Kumar 2016-11-29 18:45:36 UTC
*** Bug 47689 has been marked as a duplicate of this bug. ***
Comment 7 Sandy Armstrong [MSFT] 2017-05-08 17:44:24 UTC
This is fixed in master and will be available in Workbooks 1.3.

> Additionally: it would be nice if workbooks only listed the NuGet packages that have been added explicitly, and not the very very long list of nuget packages that results from adding this one package.

This is also fixed. :-)