Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

My project depends on some modules(nuget packages), and I have pack xml document in the packages.

When I install-package them in , xmldocument files of modules are not in my folder. I renamed a .nupkg file to .zip, unzip it ,.xml (xmldocument) is in the zip package.

How can I install the .xml documentation in my main project folder?

Update:

My project is based on Abp (abp.io), I have finished main modules,and build a aspnet core project to reference the modules.because the project contains a WebApi, I want get some module 's xmlDocument ,then the swagger info cause the project contains a WebApi, I want get some module 's xmlDocument ,then the swagger info will be perfect.

Now , My way is use post build event update the .xml files to a folder.It can solve my problem, but I want to see an idea , can use it by reference packages directly.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
274 views
Welcome To Ask or Share your Answers For Others

1 Answer

How can i install a nuget package with xmldocument

Actually, the xml docuement could be in the lib folder in the nuget.nupkg folder. However, it is only be imported into output folder of a net framework project with packages.config nuget manage format.

If you install your nuget package with PackageReference in a net framework project or install it into new sdk project(Net Core or Net Standard), the xml document file will not output to the project's bin folder.

So I assume your main project is a net core project.

Also, there is an open github issue which reflects this strange behavior xxx.pdb and xxx.xml file.

So I suggest you could use Content and ContentFiles node which is suitable for setting this xml document file into all types of projects.

Please add these node in your xxx.csproj file of the net standard class library project:

<ItemGroup>
      <Content Include="xxxx<project_name>.xml" (the path of the xml document file) Pack="true" PackagePath="contentanyany;contentFilesanyany;;">
      <PackageCopyToOutput>true</PackageCopyToOutput>         
      </Content>
  </ItemGroup>

Then you can pack this nuget project(right-click on the projecy-->Pack) and when you install this package in a new project, it will output the document file in the output folder of the main project during build process.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...