I have a few functions I want to make available to many projects I'm working on. So naturally I thought I should make a NuGet package to contain the shared code. so I:
ADUserCacheUsage.csproj
, and in a command window did nuget spec
. This generated a .nuspec
file. nuget pack ADUserCacheUsage.csproj -Build -Symbols -Properties Configuration=Release
(after all, if someone externally is using the package, they only need the release build, right?) nuget add ADUserCacheUsage.1.0.0.nupkg -source "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages"
So great, my NuGet package shows up when I select the machine source in the package manager. So I can use it in my projects.
I'm making a sample web page to use it. All the sample does is call one function and output the result on a web page.
The problem is, whenever I try and run this sample project in debug mode, I get the warning message
You are debugging a Release build of ADUserCacheUsage.dll.
So presumably I should be including a debug version of my class library in my package, in addition to the release version, right? I wouldn't want the final release of the sample project to bother with the debugging information, potentially being slow and bloated (admittedly not much of an issue on a project that's just a sample, but I'm thinking for best practices and in the future where I might have a larger, more complex package).
But I want to be able to run in debug without this error. Whenever I make a web project, it includes many other projects, and it never gives me this error with regard to, for example, NewtonSoft.json
. So what should I be doing in order to do this the right way? Does every package on nuget.org just include the debug version?
NuGet packages don't contain debug information.
Instead, there are separate NuGet symbol packages (ending with .symbols.nupkg
) that contain debug symbols ( .pdb
files) and the source code files. Symbol packages can be created using either the nuget pack -Symbols
or dotnet pack --include-symbols
command tools.
After the symbols packages are created and hosted (either on a symbol server or on the local file system), you can configure Visual Studio to use them to step through the code, even though the code in the NuGet package was built using Release
mode.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.