-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Cannot install prereleased tool package from dotnet-install-tool without specifying the exact version #9037
Comments
--prerelease will be passed to NuGet |
I may have a fix for the wildcard issue with my changes related to the uninstall command work. I propose not creating a version sub-directory (this is the source of the illegal path exception) under the staging directory when restoring and using the version number from the nuget assets file when renaming from staging to final location. |
I've confirmed that
I'll include this fix with the upcoming uninstall command implementation. |
Are we/will we only install preview with the --preview switch? |
That's my understanding. |
The reason of not support If version is not null, we assume it is a concrete version. However, in 2.* case, it is not. So it all goes wrong after that. And I don't think we should guess which is concrete version to nuget |
That's what I've implemented in the uninstall command work; I got rid of I've confirmed this works for wildcards and ranges, as well explicit versions and '*'. |
I'm going to resolve this as fixed with the merging of dotnet/cli#8615 now that it properly supports version ranges that enable installing pre-release packages:
I don't think a Please re-open this issue if you feel the fix is inadequate. Thanks! On a side note: I hope to clean up the warning / error output to try to eliminate the clutter coming from the use of the temp project soon. |
What will be the output when calling
I know our current implementation is dependent on dotnet-restore for the restore error messages...but that seems to be the tail wagging the dog. Have we considered other ways to implement package fetching that would allow us to do this? |
The output would be along the lines of (with the fix from dotnet/cli#8707):
Unfortunately, as you stated, we have limited control over the experience because we currently have to rely on a generic restore operation to install the tool package. Hopefully in the future we can improve the UX via more direct control over the package install, but that's not the plan for the 2.1 release. |
Ok. Well, supporting wildcards in --version is a good step forward. Thanks! |
Since dotnet-watch is bundled in SDK as well. I guess |
@wli3 This is about more than just dotnet-watch. It applies to all tool authors releasing tools with pre-release package versions. |
I'm not sure I understand this reasoning. The NuGet cmd line experience (and UI) has always had the concept of "please install whatever is the latest version of this package, including pre-releases". That is no less applicable in the case of global tools, and while the wildcard support is good, it's in no way the idiomatic way to do this in NuGet. Very few people know about (and even less use) version ranges or wildcards in NuGet. |
Because we use a package reference under the covers, we have to give a version range / wildcard. Perhaps we could have a |
There isn't a NuGet wildcard syntax in .csproj for this AFAIK, but there is a way to do this in NuGet's API. This kind of limitation is part of what I meant by this:
The implementation we have chosen gives us access to a very small set of the broad capabilities NuGet already has baked in. I recommend we consider using the NuGet API programmatically instead of generating a .csproj file and shelling out to dotnet-restore. |
My understanding is that it was done this way due to a technical limitation on NuGet not supporting xplat for the package management API. I think NuGet/Home#6150 is a tracking issue. Thus we're working within the confines of these limitations. I'd love to see this implementation removed in favor of an experience that is more familiar to NuGet users, including a |
Take with grain of salt: I don't know what is in the NuGet.PackageManagement API that you might need, but I know you can implement a programmatic restore with existing xplat API. MSBuild did this using RestoreRunner and I've written similar code in our build tools to download and fetch packages. |
I don't know if @wli3 looked into programatic restore vs. just invoking the restore target, but just casually looking at the implementation you provided it just seems like it'd perhaps improve tool install performance but not necessarily solve the My guess is that it was done this way in the hope that NuGet would (sooner than later) provide a xplat API for managing packages in a manner similar to the NuGet command line experience and not reinvent the wheel for what is essentially a workaround. If there is a way to accomplish this with the current xplat APIs, then I absolutely think we should investigate doing so. |
NuGet/Home#4699 CLI don't support prerelease for |
We asked NuGet as well Please follow the issue. I raised the similar question Here is NuGet's answer for why we should not use existing C# API cc @nkolev92
|
nuget.exe does have this opinion(windows only), however, dotnet add package has never supported this. NuGet/Home#4699 is still in progress. I think we should support |
Additionally, related work. //cc @rrelyea |
@wli3 honestly, I didn't even realize we didn't have |
Related: NuGet/Home#6658 |
Confirm if this is the correct summary of current thinking:
Were there any other actions items? |
As a side-note. |
@tmds the fix only goes to 2.1.4xx dotnet/cli#9525 |
@aventurella do you mean when adding a package using |
Ok, well maybe it's a non-issue? I just did:
And I rebuilt all of our local packages. Now running
Seemed to work without issue. Lemme try adding the package from Visual Studio too just to see. ¯_(ツ)_/¯ Seems to all be working as expected now. Dangit! hahahaha sorry for bugging you! |
What is the status of this issue? Installing latest pre-release tool is a badly needed scenario. |
@yufeih you can use a wildcard in the version to make it simpler, e.g.
|
@DamianEdwards , that works if you already know the exact |
unfortunately, this issue is still being blocked on NuGet/Home#912 |
While I'm not a fan of long command line options, |
FYI NuGet/Home#912 is being fixed right now. This could be revisited for an upcoming SDK update. |
Thanks! This should be an easy change once the code flows to SDK. And we would add it once it is available since it is highly requested as well. @KathleenDollard |
Is there no other work around today than knowing the complete Our use case is to try and give developers some tooling while they're working on updating the tooling[0]. I suspect our usecase is similar to what @yufeih was attempting to describe above. Having to have them edit the batch file to contain the current version is kinda a bummer, the next step is for us to write a PowerShell script to extract out the version from the CSPROJ File. Here's what we're doing (with a batch file), is there a better way? @ECHO OFF
SET PACKAGE_NAME=REDACTED
REM Clear any packages out of the local nuget package cache
REM This is because `dotnet tool install --no-cache` appears to be broken?
SET PACKAGE_CACHE_FOLDER=%userprofile%\.nuget\packages\%PACKAGE_NAME%
ECHO Attempting to Clean Existing Package Cache From %PACKAGE_CACHE_FOLDER%
IF EXIST "%PACKAGE_CACHE_FOLDER%" (
RMDIR /Q /S "%PACKAGE_CACHE_FOLDER%"
)
ECHO.
ECHO Delete Existing Packs
IF EXIST nupkg (
RMDIR /q /s nupkg
)
ECHO.
ECHO Building / Packing
dotnet pack --configuration Debug --version-suffix "dev"
ECHO.
ECHO Uninstall Existing Tooling
dotnet tool uninstall %PACKAGE_NAME%
ECHO.
ECHO Install the Latest Prerelease
dotnet tool install --add-source=nupkg --no-cache %PACKAGE_NAME% --version=2.0.0-dev [0] I heard you like your tooling in your tooling |
Try It's basically what #9037 (comment) enabled. |
@nkolev92 Solid this works, any reason to keep this open still then? or does this not work for most others? |
I think the issue is open because the switch has not been added yet. I'm not the owner though, so it's just a guess :) |
Yes. The switch has not been added yet. |
fixed in #19646 |
## Summary of changes Skips the .NET Core 3.1 NuGet dotnet-tool installer tests on prerelease versions ## Reason for change [The `--prerelease` flag isn't available < .NET 6](dotnet/sdk#9037), so we can't easily install the prerelease package in these runtime images ## Implementation details Just skip these smoke tests on <.NET 6. It's only a specific case of the NuGet install with these earlier runtimes, so it's very low risk ## Test coverage It _should_ run in this branch, but when we rebase v3-main on top, it shouldn't run
To install a prerelease version of a CLI tool, users must know the exact version they want to install. This means they have to open a browser to nuget.org or myget.org to find the package.
For example, this is the console output for dotnet-watch
This is the console output when trying to specify
--version 2.1.0-*
Ideas
--version 2.1.0-*
--prerelease
flagcc @KathleenDollard
The text was updated successfully, but these errors were encountered: