I created a nuget package, and then installed it, only to find it created a directory structure I did not expect. I’d like to know what I did wrong or what I can do to achieve my intended result. The documentation says:
Files in the
contentfolder are copied to the root of your application when the package is installed
But that is not what happened!
To clarify this question, I invoked nuget pack -BasePath staging on the following folder structure:
- staging/
- content/
- MyPlugin/
- foo.txt
- MyPlugin/
- content/
From there, when I executed nuget install MyPackage -o .\Target I expected the following results:
- Target/
- MyPlugin/
- foo.txt
- MyPlugin/
Instead what I got was this:
- Target/
- MyPlugin.1.0.1.0/
- MyPlugin.1.0.1.0.nupkg
- content/
- MyPlugin/
- foo.txt
- MyPlugin/
- MyPlugin.1.0.1.0/
Clearly the result differed from my expected result in two key ways:
- I thought the installed .nupkg would be stored somewhere else – in a cache location.
- From the documentation, I understood that
contentis a special folder which is used during packing, but does not get created on install.
What did I misunderstand? How can I fix this?
Please Note: I am purposely not specifying a packages.config or SolutionDirectory, because I intend for this nuget install to be executed at run-time to add plugins to an application. Perhaps I could be convinced to use a packages.config, but I don’t think that specifically is affecting the results I’m currently getting.
what you see is the intended behavior of the nuget.exe command line. Quoting Balliauw: