Nuget Clean Package Remove/Install - visual-studio-2010

I'd like to remove an entire nuget package, and cleanly install it in my project again.
Sadly, for some reason it skips removing files that have been "modified", and then skips putting them in the project on reinstall, because they already exist.
Is there any flag i can set to unconditionally remove every single trace of a nuget package, alternatively overwrite all existing files?
Thanks.

Unfortunately at the moment, NuGet does not do what you want. During the uninstall process, NuGet will only delete content files if they have not been modified. And as you've noticed, the update process will not update files that were modified either.
The Uninstall-Package command does have a -Force option, but that is to "force" uninstall even if there are other packages that depend on this one.
We can certainly file this as an issue and perhaps incorporate it into a future version.
Another option would be to create a PowerShell script that will enumerate a package's contents, then allow you to delete all the content files. I'll see if there is a simple way to do this.
BTW: Perhaps you can figure out a better way to extend the existing content file other than modifying it directly. Especially since you're losing your changes when the package is updated.

You can now do what you want! (finally)
You need to first update to the latest NuGet (I think this feature was added around April 2013). Do this by going to Tools > Extensions and Updates and click on Updates to update nuget.
Then the -FileConflictAction parameter will allow you to overwrite files.
Install-Package Microsoft.jQuery.Unobtrusive.Validation -Version 2.0.30506.0 -FileConflictAction Overwrite
(PowerShell Command Reference for Install-Package)

The NuGet Version 1.6 HAS a remove package function!
http://docs.nuget.org/docs/release-notes/nuget-1.6
if the update of the extension fails (signatur missmatch), just uninstall and reinstall. this is a known problem.

I think this happened to me a few times. Go to the packages.config file that should be the root directory of your project and remove the insurgent (in your case the line with the package: SignalR). This will tell NuGet that the package was never installed.
Now you will be able to reinstall it through the repository, then uninstall it so everything is back to the way it was before you got into this mess. I am unsure how it is occurring.

Related

Nuget Restore not installing content files

So it appears that when installing a Nuget package that contains additional "non-assembly" files, those files are usually copied to the appropriate locations via a PowerShell script (install.ps1). And this works all well and good, until you check your project into source control; having ignored the packages folder (cause well that's the point right...), and someone else pulls the project. In that case, when that person restores the packages, those "non-assembly" files are not re-installed, despite being copying back down to the packages folder the PowerShell script doesn't run on restore. Forcing that person to determine which packages need to be literally uninstalled and reinstalled to get things working again.
Am I missing something? shouldn't that install script just run every time... I spent several hours today trying to determine why a colleague could not get their project running after pulling it out of source control for the first time.
Is there any work-around or fix for this besides creating yet another script to check for these missing files and:
Update-Package -Id packagename -reinstall
every single offending package, and run that as a pre-build event, just to get things working.

Add NuGet package (ie. xunit.runner.console) at solution level

I need a NuGet (example xunit.runner.console) to run UT from command line.
Right now in one of project I have added xunit.runner.console as dependency so it is downloaded, path is known and I can use it in my build script.
This Project was removed and build-script is broken now. I will need to add it to another project, but the same situation can occur again (or other reasons).
I there a way to download this package but don't link it with concrete project?
You can install the nuget cli and then get the package needed using the build script. So, to answer your question, you can just use it in the build script and fetch the package before starting to build your project.

How to remove package filter?

How do I disable a package filter? I keep getting this message....
Ignoring unknown package filter 'build-tools-23.0.0_rc2'
Warning: The package filter removed all packages. There is nothing to install.
Please consider trying to update again without a package filter.
First of all make sure you have installed build-tools-23.0.0 using the sdk manager.
Then open the build.gradle file at app level and remove the 'rc2' part from the line buildToolsVersion "23.0.0 rc2"
This is how I have solved the same issue. Hope it helps.
Solved!!!
I was facing the same issue and after searching for quite a long time, I found this way around:
open your cmd
go to sdk dir
if ./tools/android list sdk -e prints id: 1 or "tools" there is an update for the sdk tools available
./tools/android update sdk -u -a -t tools installs/updates the sdk tools (it reinstalls if already installed)
It will ask y/n. Choose yes, it starts installing.
Finally what solved my problem is to download this rar file (containing the 23.0.0_rc2 sdk files), and extract it inside sdk->build-tools.
I had this same issue it was resolved after fixing my syntax in my build.gradle.
One of my closing brackets was in the wrong place.
Hope this helps

Package Restore drops pending zero, installing package does not

We have an internal NuGet feed, one of the packages is EPPlus.3.1.3.0.nupkg. Inside the package, EPPlus.nuspec file contains <version>3.1.3.0</version> and the file under package\services\metadata\core-properties\contains <version>3.1.3.0</version>.
In the package browser, it's listed as Version: 3.1.3.0. When installing this package, it is placed under packages\EPPlus.3.1.3.0. The .csproj file contains <HintPath>..\packages\EPPlus.3.1.3.0\lib\net20\EPPlus.dll</HintPath>.
When restoring the package, it's instead restored under packages\EPPlus.3.1.3. This causes the build to fail. Removing and reinstalling the package makes the build work again.
What's causing this issue?
The official NuGet repository also hosts this package, but it uses version 3.1.3 instead of 3.1.3.0
Package restore checks all your feeds in a certain order, which can be set under Options -> NuGet Package Manager -> Package Sources by clicking arrow buttons. If the official repository is listed above your internal feed, it will instead try to restore the package from there.
So while theoretically both packages should hold the same version, the project will indeed fail to build. I've raised a bug report here.

Deleting old file versions during an upgrade install

I am working with a pure InstallScript installation in InstallShield Pro 2010.
A third-party jar file has been replaced with a newer version in our software. When an upgrade installation is run, the new jar is installed, but the old jar also remains. Bad Things ensue.
How can I get InstallShield to update the contents of a folder, AND delete any other files in that location that are not included in the current version?
I've looked at the Component -> Overwrite options, but this only seems to apply "when the installer encounters an existing file with the same name as the one being installed".
Also, I realize that I could add something to the scripts to remove the offending file, but I need a scalable solution. There will be other files replaced over time, and I'd rather not have to manually add a fix to the installer every time this happens.
Can you just not change the name of the JAR file from build to build?
I'm not aware of InstallScript having a robocopy /mirror style copy. You'd have to script this behavior and I could see it not ending well quickly.

Resources