jamiet
jamiet

Reputation: 12264

Install-package succeeds, Update-Package always fails. Why?

I'm lead developer on a project where, even though we're not using .Net, we're using nuget as a packaging technology because...well...because it ticks a lot of boxes for us (i.e. packaging as a single artifact, versioning, internal nuget server for distribution). In practice we make heavy use of the <files> element in our .nuspec files to package up reusable code artifacts and then consume wherever they are required.

In each codebase in which we consume .nupkg packages we have a Visual Studio solution (.sln file) that simply contains a packages.config file, the solution contains zero projects. solution

This is working great except for one thing, we have one .nupkg (dh.PSP.SSE.Engine) that refuses to be updated. Each time we try and update-package it fails with:

Update-Package : 'dh.PSP.SSE.Engine' was not installed in any project. Update failed

update-package fails

install-package works just fine:

install-package succeeds

Here is dh.PSP.SSE.Engine.nuspec:

<?xml version="1.0"?>
<package >
  <metadata>
    <id>dh.PSP.SSE.Engine</id>
    <version>1.0.0</version>
    <authors>dunnhumby</authors>
    <owners>dunnhumby</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <summary>Strategic Scoring Engine - Engine</summary>
    <description>Strategic Scoring Engine - Engine</description>
    <releaseNotes/>
    <copyright>Copyright 2014</copyright>
  </metadata>
  <files>
    <file src="fs\**" />
    <file src="Cronacle\**" target="Cronacle" exclude="Cronacle\Cronacle.car;Cronacle\com\**;Cronacle\META-INF\**" />
    <file src="VersionNumberStamp.txt" target="VersionNumberStamp_dh.PSP.SSE.Engine.txt" />
    <file src="packages\dh.PSP.SSE.Ape.*\*.jar" target="lib" />
    <file src="packages\dh.PSP.SSE.Chimp.*\programs\*.py" target="lib" />
  </files>
</package>

We are nonplussed as to why this is happening. We have a theory that the fact we're using nuget at a solution level rather than a project level might be an issue but that said, I don't think we're doing anything that nuget wasn't designed for. Also, we have many other packages (>10), all of which update just fine.

This is a bit speculative but does anyone have any suggestions as to why this isn't working or what we might be able to do to investigate further. We're at a bit of a dead end.

Upvotes: 1

Views: 456

Answers (2)

jamiet
jamiet

Reputation: 12264

Thanks to @lloyd-holman I figured this out. My .nupkg has a "lib" folder so Nuget Package Manager thinks its a project-level nuget package. hence it can't update it as a solution-level nuget package.

Upvotes: 0

Lloyd Holman
Lloyd Holman

Reputation: 1014

Jamie, could you add the contents of the .nuspec file, it could be a subtlety between the NuGet Solution and Project level package format, maybe it has changed recently?

Taken from https://docs.nuget.org/consume/nuget-faq

Working with Packages What is the difference between a project-level package and a solution-level package?

A solution-level package has to be installed only once in a solution to be available for all projects in the solution. A project-level package must be installed separately in each project where you want to use it. For solution-level packages, NuGet doesn't change anything in a project, whereas in a project-level package it does. Typically, a solution-level package installs new commands that can be called from within the Package Manager Console window.

Upvotes: 1

Related Questions