The new .NET SDK projects allow generating NuGet packages directly from various targets as part of the build process.
I realize that content
is no longer allowed, but it looks like tools
are still a viable option.
My scenario is that I need to distribute additional content after the package is installed - I understand this can't be done via NuGet anymore and that's fine. However, I want to show a Web page that has instructions for downloading and installing the additional assets.
Essentially I'd like to do something similar to what Newtonsoft.Json
does:
I know you can use a powershell script to bring up a Web page, but is it possible to get that script into the NuGet package via the project build?
m0sa answered the question I asked, but I wanted to add some additional information here on my actual usage scenario, which is displaying a readme
file of some sort.
It turns out that Nuget supports adding a readme.txt
file to the root folder of the Nuget package and if it finds that, it will be displayed. Note the file has to be named readme.txt
- there's no support for other formats AFAIK.
While it's too bad you can't have a richer display, at least the text file activates links for clicking.
To do this:
.csproj
file:<ItemGroup>
<None Include="readme.txt" Pack="true" PackagePath="." />
</ItemGroup>
which causes the readme.txt
file to be displayed when the package is installed as a primary package. Not displayed when the file is a dependency.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With