Search code examples
nugetnuget-packagenuspec

Include non-Solution items in Nuget package


I have created a Nuspec file with the following files elements:

<files>
    <file src="lib\" target="lib" />
    <file src="tools\" target="tools" />
    <file src="content\" target="content" />
    <file src="other-stuff\" target="content" />
</files>

When I restore this Nuget package to any project, the contents of the other-stuff folder is added to the project (as expected).

Is there any way to ensure this content is placed on the filesystem, but not added to the project / solution? I don't want this content to show in Visual Studio.


Solution

  • There is no way to create a folder with no content in the nuspec file. However, you can definitely do this using a install.ps1 file. You can find many examples by searching for "nuget install.ps1" and utilizing powershell code to create a directory.