-
Notifications
You must be signed in to change notification settings - Fork 249
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
Update-Package -reinstall -ProjectName <project> does not work for PR #6088
Comments
@karann-msft - what is your expected behavior? (what versions of which packages should be upgraded to?) |
the expected behavior is the same as what you you would see if you ran that command for a PC based project. Uninstall and then install all packages.
Why would I remove "-reinstall" ? I WANT to reinstall. I don't want to upgrade and hence don't care if one is available. The reason I did get-package was to show that the project did have packages installed. Its a netstandard 2.0 class library. |
@karann-msft after reading some docs around the reinstall flag, I feel that this behavior is correct. Since PR has packages in global packages folder there is nothing to reinstall. Why dont you try deleting one of the packages from the global packages folder and then try reinstall. It should redownload the package. |
@mishra14 There are only two options here - fix that message to state that resinstall is not supported for PR (and the docs to call out that this only supported in PC), or it should do exactly what it does for PC. |
You are running an |
Take a look at the switch it's being run with. |
We need to determine what is the appropriate behavior for reinstall is in PR. |
There was another customer report here. The "reinstall" flag is only there because of all the issues people ran into when running installs. In Package Reference that's not the case. So it can't really do the same thing as PC, because even in PC, you don't delete the packages from the global packages folder. Since the concept does not exist, I think the other option is the best.
|
For what it's worth I'm with totally with @karann-msft on this one. Make it explicit that There are common cases like zipping up a project folder, moving it to a different machine, where references on the new machine can be all out of whack. Most devs would think Also, I'd recommend NOT updating version numbers if |
@bchavez The not updating a version number if -Reinstall is passed is a hole because the -Reinstall flag is completely ignored. As I mentioned in my previous comment. The zipping up a project, and extracting in a different directory scenario, whenever you run restore again, that'll update the assets file and msbuild props/targets. The idea there is that once you extract that file, you run a rebuild, and it just works. Basically there's no point in anyone ever doing -Reinstall here. PackageReference is smart enough to do that in simple restore. I'd say no-oping if someone does attempt that for package reference with a clear message would be the way to go. We have designed a more streamlined workflow and we want people to be using that workflow. |
I need an option to re-download the package into Global packages directory. I am just thinking may be |
I think the question there is "why" do you need to do that. I'd say we want to design for thescenario (local package dev testing would is restricted on the "refreshing" of global packages folder, even there though we'd look for a way to not re-download everything). The Update-Package -reinstall is very much a "this project" command. tl;dr |
My scenario is that I have an existing project where I want to use VSTS Package Management. We want to leverage the "upstream" capabilities of it, so that we can specify a single feed in our Project, and VSTS takes care of aquiring the package from the right stream. Now, to be able to do this, you have to execute an "Install" action on the packages that are already installed. A -Reinstall would have been good in this case. |
I'd like to use -Reinstall in order to automatically update the AssemblyBindings section of my app.config. |
@joshmouch @MichelZ The global packages folder is shared among projects. |
@nkolev92 |
In Package Reference NuGet does not deal with binding redirects. For more references, please look at: |
Unfortunately, the automatic binding is buggy and doesn't work on large projects. |
@nkolev92 The world is so much more complicated than you can imagine, and on top of that we have Murphy!
It's a bold and brave statement to make, to have such confidence and be so sure of yourself, that a situation can not occur where you would need to reinstall the nuget packages for a project, no matter what other software is installed, what hardware that might have crashed and rendered who knows what corrupt, or what creative and ingenious modifications a user might have done to files, settings, registry, configurations or anywhere else, respect! Myself, i'm a bit more humble, but then I've only been a consultant and a developer since the early 90ies. And I totally agree with what Einstein said about "human stupidity", and can personally add that it holds true for human creativity and ingenuity as well, when it comes to unorthodox and interesting ways of using computers and software. I can't think of one single thing where computers and software is involved, where I feel comfortable making a statement like "you will never need to do this"....I'm just thinking of the NTFS-Guys, who said "no need to run defrag on NTFS", but now it's built into windows, and runs automatically.... |
I have the same issue. When I remove a reference using a tool, this can remove the file reference, but leave the reference in packages.config (or something went wrong with the install scripts added to the nuget). This would then REPAIR the package to it's original state instead of doing an update. |
What you are articulating sounds like it is related to packages.config. |
Does it matter if it is for Niger cobfig or package reference. Fact is that links can get corrupted and because of dependencies simple remove and install doesn't cut it either way. |
It does. In packages.config the installation is 2 part, the packages.config file and the references in the project file (.csproj). The references in the project file hard code a relative path to the assets chosen (like the dll). In PackageReference, the installation is simply the package id and package version. The title and body of this issue talk about the Your scenario looks different from the one being discussed in this issue. Please file a different issue for the problems you are running into. |
This is extremely frustrating. I'm trying to get copies of certain DLLs into my output folder and this thread is the only documentation I can find that indicates Update-Package -reinstall doesn't work on .net core projects. The I got here because this thread on StackOverflow states that it will copy the DLLs into the output folder, but it does not: |
@dkattan PackageReference works differently from packages.config. PackageReference is .NET Core projects is integrated with the build, and the files necessary will be copied to the output directory at build time. If there are files that are not getting copied to the output, it's likely a different issue, or just how the package itself was authored. |
You are correct. Turns out the project I was loading had overloaded the Assembly.Load event and was doing some hacky stuff at runtime. |
Please refer to #6088 (comment) and NuGet/docs.microsoft.com-nuget#2520 |
The text was updated successfully, but these errors were encountered: