Updating Files in Existing Nuget Package

I have a multi-project ASP.NET Web Forms Application. I need to share the main page (3 files), some user controls and some images, scripts and CSS files with other projects in the solution.

I already created the package using the NuGet Package Explorer according to the documentation:

http://docs.nuget.org/docs/creating-packages/using-a-gui-to-build-packages

My current problem is this: I updated the shared files in the root project, and now I want to update the package before pulling it to other projects (the package is currently located in a local folder on my dev machine). How to do it?

If anyone has links to NuGet with speed, please share them, as the white papers just don't do it for me.

+1
source share
4 answers

create the package again with the new version of aka if orginal 1.0 does it 1.1 and NuGet picks up the update.

+1
source

You ask what you need to do to update projects that already use the package?

The key point in this scenario is simply version control. A new version of the file will be released. Add the package with the new version number again, and then run Update-Package from the package manager console in VS.

, . CSS, MasterPage, .

PM Explorer ( , ), NuGet, jQuery 1.5.1 1.6.x, , . !

.

0

. , .nuspec.

: "[]. [].nupkg", "[]. [ +1]. nupkg 'as .

" nuget".

0

Ultimately, a NuGet file is just a zip file. You can update records using anything that can update a ZIP file. Such as something like

using System.IO.Compression;
using System.IO.Compression.FileSystem;

// EG: AddOrUpdateZipEntry("mypackage.nupkg", "my.dll", "bin/my.dll")
void AddOrUpdateZipEntry(string zipFilePath, string contentsFilePath, string entryPathInZip)
{
    using (var zip = ZipFile.Open(zipFilePath, ZipArchiveMode.Update))
    {
        zip.GetEntry(entryPathInZip)?.Delete(); // Remove any existing entry first.
        zip.CreateEntryFromFile(contentsFilePath, entryPathInZip);
    }
}
0
source

All Articles