0

I would like to add a chm file (documentation) to my nuget package. Is that possible? I saw this question, but it's from 2011 and I wonder if anything has changed since then.

If it's possible, I'd like to know how to do it through Visual Studio. My nuget package gets created by msbuild directly from the csproj file (from which an intermediate nuspec file gets created).

I noticed that if I add this line in the intermediate nuspec file

<file src="Content\**" target="content" />

and build the package, the chm file does get added to the package, but I don't know how to view it after I install the package in another solution. Is it possible?

SaiyanGirl
  • 16,376
  • 11
  • 41
  • 57
  • Hi, per this doc: https://learn.microsoft.com/en-us/nuget/reference/nuspec#including-content-files and Content files are immutable files that a package needs to include in a project, you can have a try with your shared config and publish this package, it should works as your expected. – Sara Liu - MSFT May 08 '19 at 07:41
  • @SaraLiu-MSFT Thank you for the reference. You're right, the file does get added to the package and is displayed. The `` in nuspec did the work for me. However, I am not sure how to specify this file in the original csproj file. – SaiyanGirl May 08 '19 at 14:50
  • The change I needed to make in my csproj file was adding this line: ` ` . My documentation is located in a `content` folder which is in the same folder as the `csproj` – SaiyanGirl May 08 '19 at 19:01
  • 1
    Hi, you can have a try with true , by default everything of type "Content" gets included in the package, for more detail information, please check this: https://learn.microsoft.com/en-us/nuget/reference/msbuild-targets#pack-scenarios, since with the PackageReference format, NuGet 4.0+ can store all manifest metadata directly within a project file rather than using a separate .nuspec file, you need consider use the PackageReference format. – Sara Liu - MSFT May 09 '19 at 01:58

0 Answers0