I'm responsible for a library published in our company as a NuGet package, and I followed the "Adding a readme and other files" guide to show a readme.txt containing important changes when users install or update the package when using Visual Studio. This works - i.e. when you install the package the readme.txt is displayed. However when you install the package this readme.txt files is also being copied into the root directory of the target project.
Does anyone know how I can stop this (i.e. show the readme.txt when install, but don't add it to the target project)? It's quite useful for users to see this file, but confusing if it gets added to the project.
The .nuspec for the library like the below:
<?xml version="1.0"?>
<package >
<metadata>
<id>$id$</id>
<version>$version$</version>
<title>$title$</title>
<authors>$author$</authors>
<owners>$author$</owners>
<projectUrl>http://example.com/blah/blah</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>$description$</description>
</metadata>
<files>
<file src="README.txt" target="" />
</files>
</package>
The packing + pushing is normally performed by a TeamCity build step, but if I build the pkg using the following command line then the same behaviour is present:
$ nuget pack MyLibrary.csproj
$ nuget push MyLibrary-{version}.nupkg -source {internal-nuget-server}
The issue here was that I had the README.txt
included in the .csproj
file using <Content include...>
when really it should have been <None include...>
- sorry this was somewhat of a Red Herring since I didn't include this information in my question!