的NuGet:包括.pdb文件和排除"内容"夹文件、内容、NuGet、pdb

2023-09-05 00:09:03 作者:壹失足成萬古恨

我已经纳入了以下行CI-打造为每个版本创建一个私有的NuGet包

I've incorporated the following line in the CI-build to create a private NuGet package on each build:

nuget pack C:\Projects\Test\Test.vbproj -OutputDirectory \\nas1\NuGet 

在集信息读(包括版本号),并创建一个的NuGet包。 我想包为包括.pdb文件和不包含一个内容的文件夹(所以才有了'库')

The AssemblyInfo is read (including the version number) and a NuGet package is created. I'd like the package to include the .pdb files and not contain a "Content" folder (so only the 'lib').

如何我更改命令,以做到这一点?

推荐答案

不幸的是,我不认为你就可以排除两者的内容文件的和的包括同时包装的.pdb文件通过该项目。你可以做一个或另一个。

Unfortunately, I don't think you'll be able to both exclude the content files and include the .pdb files while packing via the project. You could do one or the other.

首先,在 nuspec 文件(的NuGet规范命令使这种快速),并把它放在相同的位置,你的项目。当你收拾你的项目,NuGet.exe将把规范作为补充到项目的信息。

First, make a nuspec file (the nuget spec command makes this quick) and put it in the same location as your project. When you pack your project, NuGet.exe will treat the spec as a supplement to your project's info.

要消除内容文件夹,包装一个项目,也有.nuspec文件,当一个空的<文件/> 中的规范节点将表明您不希望任何内容的文件,即使他们在项目中存在。

To eliminate the content folder, when packing a project that also has a .nuspec file, an empty <files /> node in the spec will indicate that you don't want any content files, even if they exist in the project.

要包括调试文件,添加这样的事情您规格:

To include the debug files, add something like this to your spec:

  <files>
    <file src="bin\*.pdb" target="lib\net35\" />    
  </files>

但会告诉你的执行的有内容,然后它会添加所有的等的文件,以及该工具。你可以,也许,做一个符号包为您的项目代替。

but that would tell the tool that you do have content, and then it would add all the other files, as well. You could, perhaps, make a symbol package for your project, instead.

另一种选择是从规范专门打造(的NuGet包Test.nuspec ),并明确指定要包括的文件。这是更费时,但它可以让你完全控制包的内容。

Another option would be to build exclusively from the spec (nuget pack Test.nuspec), and specify exactly the files you want to include. It's more time consuming, but it gives you complete control over the package's contents.