Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotnet add package - support for Nuget "Pre" version #4699

Open
livarcocc opened this issue Feb 27, 2017 · 16 comments

Comments

Projects
None yet
@livarcocc
Copy link

commented Feb 27, 2017

From @yooakim at dotnet/cli#5752

I'm not sure this is a bug but it would be nice if one could add NuGet packages with the -pre version as used by NuGet.

Steps to reproduce

dotnet add package Swashbuckle --version pre

Expected behavior

<Project Sdk="Microsoft.NET.Sdk.Web">                                                   
                                                                                        
  <PropertyGroup>                                                                       
    <TargetFramework>netcoreapp1.1</TargetFramework>                                    
  </PropertyGroup>                                                                      
                                                                                        
  <ItemGroup>                                                                           
    <Folder Include="wwwroot\" />                                                       
  </ItemGroup>                                                                          
                                                                                        
  <ItemGroup>                                                                           
    <PackageReference Include="Microsoft.AspNetCore" Version="1.1.0" />                 
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.1" />             
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.0" />   
    <PackageReference Include="Swashbuckle" Version="6.0.0-beta902" />                  
                                                                                        
  </ItemGroup>                                                                          
                                                                                        
</Project>                                                                              

Actual behavior

C:\Code\Coach\src\Coach.API [master]> dotnet add package Swashbuckle --version pre
Microsoft (R) Build Engine version 15.1.545.13942
Copyright (C) Microsoft Corporation. All rights reserved.

  Writing C:\Users\Joakim\AppData\Local\Temp\tmp2F1A.tmp
error: 'pre' is not a valid version string.

## Environment data
`dotnet --info` output:
@rohit21agrawal

This comment has been minimized.

Copy link
Contributor

commented Feb 27, 2017

CC : @mishra14

@mishra14

This comment has been minimized.

Copy link
Collaborator

commented Feb 27, 2017

@livarcocc :

You can do dotnet add package newtonsoft.json -v 10.0.0-* to get the prerelease packages.

log -

log  : Installing Newtonsoft.Json 10.0.1-beta1.
info : Package 'newtonsoft.json' is compatible with all the specified frameworks in project 'E:\NuGet.Client\cli_test\cli_test.csproj'.
info : PackageReference for package 'newtonsoft.json' version '10.0.0-*' added to file 'E:\NuGet.Client\cli_test\cli_test.csproj'.

This will add -

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard1.4</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="newtonsoft.json">
      <Version>10.0.0-*</Version>
    </PackageReference>
  </ItemGroup>
</Project>

The --pre flag was not added because restore does not have an explicit way of request prerelease packages. Maybe @emgarten can chime in here?

@jacek-jaskolski

This comment has been minimized.

Copy link

commented Mar 7, 2017

@mishra14 I'm trying to dotnet add package rawrabbit -v 2.0.0-* and it gives me:

Please specify one package reference to add.
.NET Add Package reference Command

Adding <PackageReference Include="rawrabbit" Version="2.0.0-*"> to csproj file and restoring the packages works fine.

Using version 1.0.0-rc3-004530

@mishra14

This comment has been minimized.

Copy link
Collaborator

commented Mar 7, 2017

@jacek-jaskolski : We initially had a problem about placing -v param in the command after the package name. But that was fixed a while ago here: dotnet/cli@04a7fca.

Please try the latest dotnet cli and it should be fine.

@terrajobst

This comment has been minimized.

Copy link

commented Mar 29, 2017

At the very least the error message needs to change. This is the current experience:

$ dotnet add package Alexa.NET
Microsoft (R) Build Engine version 15.1.523.56541
Copyright (C) Microsoft Corporation. All rights reserved.

  Writing C:\Users\immol\AppData\Local\Temp\tmp9BFC.tmp
info : Adding PackageReference for package 'Alexa.NET' into project 'T:\Test\Test.csproj'.
log  : Restoring packages for T:\Test\Test.csproj...
info :   GET https://dotnetmyget.blob.core.windows.net/artifacts/dotnet-corefxlab/nuget/v3/flatcontainer/alexa.net/index.json
info :   CACHE https://api.nuget.org/v3-flatcontainer/alexa.net/index.json
info :   GET https://dotnetmyget.blob.core.windows.net/artifacts/dotnet-core/nuget/v3/flatcontainer/alexa.net/index.json
info :   NotFound https://dotnetmyget.blob.core.windows.net/artifacts/dotnet-corefxlab/nuget/v3/flatcontainer/alexa.net/index.json 132ms
info :   NotFound https://dotnetmyget.blob.core.windows.net/artifacts/dotnet-core/nuget/v3/flatcontainer/alexa.net/index.json 135ms
error: Unable to resolve 'Alexa.NET' for '.NETCoreApp,Version=v2.0'.
error: Package 'Alexa.NET' is incompatible with 'all' frameworks in project 'T:\Test\Test.csproj'.

The message implies that the package isn't compatible, not that it cannot be found. FWIW I'm not a fan of the -v <version> number as the sole way to install pre-release packages. The whole point of using the CLI to install the package is so that I don't have to look up the version number on NuGet org. I want to be able to quickly add a package in a sensible version (latest stable).

Ideally, this is how I would like the UX to be:

$ dotnet add package Foo
There are no stable packages for Foo. Consider specifying --pre to install the latest pre-release version.
$ dotnet add package Foo --pre
Installed package Foo 1.0.0-beta-5.

/cc @timheuer @bjorg

@terrajobst terrajobst referenced this issue Mar 29, 2017

Closed

Merging of Slight.Alexa #3

1 of 5 tasks complete
@timheuer

This comment has been minimized.

Copy link

commented Mar 29, 2017

@terrajobst is right. There are actually two things here. Bug: the error message is WRONG. Feature: add support for grabbing prerelease.

How can we at least fix the error message?

@mishra14 mishra14 added this to the 4.3 milestone Mar 29, 2017

@billwert

This comment has been minimized.

Copy link

commented Apr 4, 2017

@richlander and I hit this last night as well. The experience must get better. I really like @terrajobst's suggestion of informing the user that no packages were found; I'd go a step further and only suggest --pre if pre-release packages exist. Otherwise just inform the user the package doesn't exist.

This sort of output is just frustrating:

error: Unable to resolve 'thiscantbeapackage' for '.NETCoreApp,Version=v2.0'.
error: Package 'thiscantbeapackage' is incompatible with 'all' frameworks in project 'whatever.csproj'.
@rrelyea

This comment has been minimized.

Copy link
Contributor

commented Apr 5, 2017

We are doing some error/warning rework in nuget restore in our 4.3 release. If things go well, internal consumers of restore (like dotnet add package) could have better ability to understand those errors, beyond just passing along the log output.
/cc @mishra14

@rrelyea rrelyea modified the milestones: 4.4, 4.3 Jun 27, 2017

@rrelyea

This comment has been minimized.

Copy link
Contributor

commented Jun 27, 2017

blocked by lack of 4.4.- support in versions right now.

@nietras

This comment has been minimized.

Copy link

commented Feb 21, 2018

What is the status of this? It's been several months, and this does not seem to have been added yet. I need this as well.

@terrajobst

This comment has been minimized.

Copy link

commented Feb 21, 2018

@rrelyea, what are your thoughts on making the cut for an upcoming release? It's probably too late for 2.1, but it's a high hitter in the UX. What's the next train this could catch?

@mishra14 mishra14 added Priority:0 and removed Priority:1 labels Feb 22, 2018

@mishra14

This comment has been minimized.

Copy link
Collaborator

commented Feb 22, 2018

@terrajobst I have moved it to Priority 0 to reflect the request.

@terrajobst

This comment has been minimized.

Copy link

commented Feb 22, 2018

Thanks!

@nietras

This comment has been minimized.

Copy link

commented Jun 19, 2018

@mishra14 @terrajobst this issue is still open, has it not been resolved yet?

@mishra14

This comment has been minimized.

Copy link
Collaborator

commented Jun 29, 2018

This is blocked by #912.

@shanselman

This comment has been minimized.

Copy link

commented Jan 17, 2019

O_O

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.