NuGet:包含 .pdb 文件并排除“内容"文件夹 [英] NuGet: include .pdb files and exclude the "Content" folder

查看:30
本文介绍了NuGet:包含 .pdb 文件并排除“内容"文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 CI-build 中加入了以下行以在每个构建上创建一个私有 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 

读取AssemblyInfo(包括版本号)并创建NuGet 包.
我希望该包包含 .pdb 文件并且不包含内容"文件夹(因此只有lib").

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 spec 命令可以快速完成)并将其放在与您的项目相同的位置.打包项目时,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文件的项目时,规范中一个空的<files/>节点将表明你不想要任何内容文件,即使它们存在于项目中.

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 pack 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.

这篇关于NuGet:包含 .pdb 文件并排除“内容"文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆