I'm trying to reinstall a package on CentOS: yum reinstall packagename however I can still see the changes that I made in the config files from this package.
Is there a way to force the re-load of the package and its config files?
Check to see whether the reinstall of the package also created the config files with filenames ending with ".rpmnew". If such files exist, they will be the unmodified versions of the files.
If that is not the case, can you perform the package reinstallation in the two steps instead of one? That is, first do yum remove packagename and then do yum install packagename.
If neither of the above will do the trick, the simplest way to solve the problem is to rename or remove the config files and then do the yum reinstall.
Related
In the project I've been using some custom NuGet sources. Apparently some of them are no longer available but I do have the newer (and only newer) versions of the packages on the other (still working) server. Is there a way to restore the packages directly to the newest versions without manually replacing all the references in the .csproj and packages.config files?
I've tried running Updade-Package -Reinstall but I only get the following error message:
Some NuGet packages are missing from the solution. The packages need to be restored in order to build the dependency graph. Restore the packages before performing any operations.
If some packages you use (and still want to use) are no longer available, I suggest you to make a backup of them.
Find the Nuget cache on your server. On Windows this is located at
%userprofile%.nuget\packages
Spot the packages (and version) you want to backup and copy the .nupkg files in their respective folders.
Then you have two choices:
Create a private Nuget feed
Create a local Nuget feed on your development machine
The 1st option has the advantage to be a single source that can be used on any machine you want (development machine, build server...etc) but you will have more set-up, especially for the authentication/authorization (because it's a private feed)
For the 2nd option: Simply create a C:/Nuget folder and put any .nupkg you want.
Then in Visual Studio go to:
Tools -> Nuget Package Manager -> Package Manager Settings -> Package Sources
Click on the green + button to add a new source, simply give it the name Local and browse to your C:/Nuget to set the source.
From now on when you want to restore your Nuget packages, Visual Studio will first look into the nuget.org feed and if it doesn't find the referenced packages, will then look into your Local feed and cache the installed package to the %userprofile%.nuget\packages of your machine.
I hope that answer to your question, I was not quite sure about what you asked and your knowledge about Nuget.
UPDATE:
I think I understand your question better now.
First of all, I think your misunderstand the Update-Package -Reinstall command. It will reinstall the packages with the SAME version as already referenced but simply reinstalling them. It's a useful command for example when you change the target framework of your project. Then you can reinstall the same versions of the packages and they will retarget this .NET Framework version.
So if a nuget restore isn't working then Update-Package -Reinstall will obviously fail too.
With Nuget, when something isn't working, you shouldn't insist but instead, find the tweak that will make it working again. I can't count how many times I went to the different caches to delete some cached packages.
I think you should try to use nuget restore and see what packages are causing issues, then uninstall these packages (this will just remove the reference from the .csproj and packages.config if they aren't installed in the project yet), then you can finally install the newest version of these packages.
I'm having more than one solution file for my project each pointing to a different target frameworks.
I'm able to restore the nugets for each solution using nuget restore command.
The problem arises when i try to use the update command.
Found multiple project files for package warning is shown and my packages are not updated to the latest version.
Am i doing anything wrong here?
According to this question:
using nuget.exe commandline to install dependency
The command line NuGet tool does not follow dependencies intentionally. While I could understand this as the default behavior, it seems odd to me that there is no choice to have the tool follow the dependencies. Is anyone aware of the reasoning behind this?
That answer is specific to running nuget install packages.config.
When specifying packages.config, only explicitly listed packages are installed.
However, if you try installing a specific package: nuget install My.Package.Id then NuGet will install the package and any dependencies.
EDIT Additional info as to why there's a distinction.
nuget install should really be called nuget download. It doesn't really install in the traditional sense. That is, it doesn't add references to your project files, it doesn't run install.ps1, it doesn't update packages.config, etc. You need to either use the NuGet GUI or Package Manager console to get a true install.
Since the true install updates packages.config, this file already includes all the dependencies that were installed. So specifying the file means, I want to download these specific packages. NuGet doesn't need to think about it since it's basically pre-calculated.
If you want to install/download multiple packages and have NuGet follow dependencies, just create a batch file and issue multiple commands:
nuget install My.Package.Id
nuget install Another.Package.Id
This will cause NuGet to fetch the package an any dependencies it may have.
Hope this clarifies things.
For my little sample projects in .NET (built directly on the command line without employing Visual Studio) I want to use directly Nuget.exe to retrieve the libraries I need, without having to commit them in the source repository.
I've been able to install them using the command
nuget install packages.config -o $destinationFolder
specifying the needed packages in a packages.config (like Nuget in Visual Studio).
However, I'm unable to update installed packages. I've tried to use this command
nuget update packages.config -r $destinationFolder
but Nuget.exe complains that is
unable to locate project file for '...packages.config'`.
I've searched on the Internet but I only find a similar question in the Nuget discussion forums without answers.
I've read the relevant source files in the Nuget project and I've discovered that for the update to succeed Nuget.exe needs to find a Visual C#/Basic/F# project.
I then created an empty csproj file in the folder and I've been able to update the packages I've installed before.
I've made a small sample at https://github.com/edymtt/nugetstandalone that shows how to install and update packages with Nuget.exe. I've also used a workaround to make sure that only the latest versions of the libraries are kept in the folder.
Update 2013-04-06 14:20 UTC I've updated the sample to show how to achieve that using the -ExcludeVersion flag of the install command.
I'm using NuGet to download a bootstrap less version. Unfortunately, it installs the LESS files in /Content/Less. I would prefer that it installs it to Content/Style/Bootstrap.
I can make these changes manually in my solution, but it would be nice to automate this as the package is updated. I wouldn't mind creating a new NuGet package if necessary. I've read about .transform and .pp files.
I now it's an outdated question but you could just unzip the package. Move the less files into the folder you want, update the nuspec file if necessary and then repack the file again. With powershell and the new ZipArchive/ZipFile class in .net 4.5 this could be done in minutes.