NuGet:包含 .pdb 文件并排除“内容”文件文件夹

发布于 2025-01-01 01:04:32 字数 385 浏览 0 评论 0原文

我在 CI 构建中合并了以下行,以在每个构建上创建一个私有 NuGet 包

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

读取AssemblyInfo(包括版本号)强>)并创建一个 NuGet 包。
我希望包包含 .pdb 文件并且不包含“Content”文件夹(因此只有“lib”)。

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

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 

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').

How can I change the command to do that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

小女人ら 2025-01-08 01:04:32

不幸的是,我认为您在通过项目打包时无法同时排除内容文件和包含 .pdb 文件。你可以选择其中之一。

首先,创建一个 nuspec 文件(nuget 规范命令使此操作变得快捷)并将其放在与您的项目相同的位置。当您打包项目时,NuGet.exe 会将规范视为项目信息的补充。

要消除内容文件夹,在打包也包含 .nuspec 文件的项目时,规范中的空 节点将指示您不需要任何内容​​文件,即使如果它们存在于项目中。

要包含调试文件,请将类似以下内容添加到您的规范中:

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

但这会告诉工具您确实有内容,然后它会添加所有其他文件,以及。您也许可以制作一个 符号包 为您的项目。

另一种选择是专门根据规范进行构建(nuget pack Test.nuspec),并准确指定要包含的文件。这比较耗时,但可以让您完全控制包的内容。

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.

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.

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.

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.

往昔成烟 2025-01-08 01:04:32

对于您不想打包的内容文件,您是否需要它们在项目中具有“内容”的构建操作(在 Visual Studio 中文件的属性窗口中,如果这是您的 IDE)?

如果可以将“构建操作”更改为“无”(或其他任何内容),那么它最终不会出现在内容文件夹中。

On the content files that you don't want to package, do you need them to have a Build Action of "Content" in your project (in the properties window of the file in Visual Studio, if that is your IDE)?

If it is acceptable to change the Build Action to "None" (or anything else), then it won't end up in the content folder.

梦幻之岛 2025-01-08 01:04:32

如果您不介意也包含源文件,则以下解决方案有效。
要忽略内容文件,请将这样的空节点添加到您的 nuspec:

<files>
</files>

然后运行:

nuget pack C:\Projects\Test\Test.vbproj -Symbols
nuget push  *.symbols.nupkg -Source \\nas1\NuGet

The following solution works - if you don't mind including source files too.
To ignore the content files add such an empty node to your nuspec:

<files>
</files>

And then run:

nuget pack C:\Projects\Test\Test.vbproj -Symbols
nuget push  *.symbols.nupkg -Source \\nas1\NuGet
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文