是否可以在网络共享的 NuGet 本地源中同时托管常规包和符号包? [英] Is it possible to host both regular and symbols packages in a NuGet local feed on a network share?

查看:30
本文介绍了是否可以在网络共享的 NuGet 本地源中同时托管常规包和符号包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我对 NuGet 还是很陌生.我在工作中开发了许多内部 C# 桌面应用程序,它们之间共享了一些通用代码.我一直在从使用项目引用切换到创建私有 NuGet 包并将它们托管在位于共享网络文件夹中的本地源中.我现在只研究了几天,但到目前为止我已经成功地将我的一些库项目转换成包并在其他项目中使用它们.

问题是,虽然我可以在依赖它们的其他解决方案中使用这些包提供的代码,但我没有获得 IntelliSense 支持或在包本身内进行调试的能力.事实证明,只有组装好的 DLL 分布在普通包中,根据我从网上搜索收集到的信息,我还需要创建包含 IntelliSense 和调试所需文件的符号包.

如何做到这一点 - 同时使用常规包和符号包 - 当使用网络共享文件夹作为本地提要时?许多在线答案都建议使用单独的符号服务器.但是,我无法将此代码公开发布到 symbolsource.org,而且我目前无法从我的雇主那里获得一台服务器来托管(这消除了 NuGet.Server、ProGet 等解决方案).我正在寻找的可能吗?

我已经看过关于创建

或查看 MSDN.请注意,调试时无法打开解决方案属性.

使用 .nuspec 中的此设置,您只需在网络共享上的 NuGet 本地源中设置此常规包.安装这个包,然后你就可以在包内调试了.

此外,SymbolSource 发布了一个名为 SymbolSource Server Basic 的社区版 现在.

First off, I am still very new to NuGet. I have a number of internal C# desktop applications I develop at work, with some common code shared between them. I have been in the process of switching from using project references to creating private NuGet packages and hosting them in a local feed situated in a shared network folder. I've only been at it for a few days now, but I have successfully managed to turn a handful of my library projects into packages and use them in other projects so far.

The issue is that, while I can use the code these packages provide in my other solutions which depend upon them, I do not get IntelliSense support or the ability to debug within the package itself. It turns out that only the assembled DLL is distributed in the normal packages, and from what I've gathered from searching online, I also need to create symbol packages which do include the files needed for IntelliSense and debugging.

How can I do this - using both regular packages and symbol packages - when using only a network share folder as a local feed? Many answers online suggest using a separate symbols server. However, I can't publicly publish this code to symbolsource.org and I am not currently able to get a server from my employer for hosting one (which eliminates solutions such as NuGet.Server, ProGet, etc.). Is what I'm looking for even possible?

I already looked at the official documentation on creating symbol packages and local feeds, as well as this related question. But none of those has the information I am looking for.

EDIT: I did get the IntelliSense support for my packages' code working by remembering to turn on XML documentation generation at build time, using information from this question. Still not sure about the debug support, though.

解决方案

How can I do this - using both regular packages and symbol packages - when using only a network share folder as a local feed?

I`m afraid the answer is no. When I host both regular and symbols packages in a NuGet local feed on a network share, then I installed that package to my test project, go to debug, Visual Studio could not load the .pdb file. Because the .pdb file is wrapped in the symbol package, Visual Studio could not access it directly. So the suggestion is that "using a separate symbols server.".

Since you can't publicly publish this code to symbolsource.org and can not currently able to get a server from your employer for hosting one, I would like provide you a lightweight solution here:

  1. Put the pdb and source code file in the NuGet package alongside the dll.
  2. Add the source code to the Debug Source Files for the solution that references the package.

This means you'll be able to step through code and view exceptions, but you might have to find a file on disk and open it before you can set a break point. Obviously you need to be careful that the source is at the right revision.

More detail on step 1:

If you're currently packaging without a Nuspec, you'll need to create a Nuspec, then add the pdb to the list of files in the lib folder and source file in the src folder. "NuGet spec" may be a useful command for generating the initial spec as defined in NuGet docs. Below is my .nuspec file, you can check it:

<?xml version="1.0"?>
  <package >
    <metadata>
     <id>MyTestPackage</id>
     <version>1.0.3</version>
     <authors>Admin</authors>
     <owners>Admin</owners>
     <requireLicenseAcceptance>false</requireLicenseAcceptance>
     <description>Package description</description>
     <releaseNotes>Summary of changes made in this release of the package.</releaseNotes>
     <copyright>Copyright 2017</copyright>
     <tags>Tag1 Tag2</tags>
   </metadata>

   <files>
     <file src="bin\Debug\MyTestPackage.dll" target="lib\Net46" />
     <file src="bin\Debug\MyTestPackage.pdb" target="lib\Net46" />
     <file src="Class1.cs" target="src" />
   </files>
</package>

More detail on step 2:

When you have a solution open, right click on Solution, select Properties...Common Properties...Debug Source Files, and add the root source directory for the relevant binary reference.

Or see MSDN. Note, you can't open the solution properties while debugging.

With this settings in the .nuspec, you only need to set this regular package in a NuGet local feed on a network share. Install this package, then you can to debug within the package itself.

Besides, SymbolSource released a community edition called SymbolSource Server Basic now.

这篇关于是否可以在网络共享的 NuGet 本地源中同时托管常规包和符号包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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