Reputation: 180
I have an empty legacy SDK C# class library project (with new Class1 class and single empty method inside him) and I want to publish it with symbols. I did this in the past for SDK project, but it looks like a sourcelink is not supported for legacy .net 4.5.2 .NET Framework projects (despite SymbolPackageFormat=>snupkg
configuration in the project file, the produced package is in .symbols.nupkg
format).
So, my steps are:
1. nuget pack -Build -Symbols -OutputDirectory "..\artifacts" -Version 1.0.0
created 2 packages: PackageName.Version.nupkg
and PackageName.Version.symbols.nupkg
2. nuget push PackageName.Version.symbols.nupkg -Source https://api.nuget.org/v3/index.json -ApiKey ###
The package has been successfully published with .pdb files. There are PackageName.dll
and PackageName.pdb
in the lib
folder inside the package storage folder (inside packages
) and in the bin
folder in the project itself. But when I try to debug the package library after consuming, I see the error:
*Source Not found*
Class1.cs not found
You need to find Class1.cs to view the source for the current stack frame.
Also, even if I fix it, does it mean that during consuming I have to decide which package should I consume, either: normal .nupkg
or symbols.nupkg
(assuming that I also need to publish both of them too with different name, like PackageName vs PackageName.WithSymbols)?
UPDATE: i found how to generate snupkg file for .net framework app (not sdk), but it gives the same class1.cs not found
error.
UPDATE2: If you add the link to the sources that produced the nuget package in the solution settings (Common Properties => Debug Source File => Directories containing source code), then the issue is gone, but it doesn't look like the best way since you will always need to checkout the code that produced the nuget somewhere on the current machine
UPDATE3 There are some options that looks like suppose to configure this behavior for example <DebugType>embedded</DebugType>
(as pointed by @Dai), however I really don't see a difference in this option (regardless it's .net452 or .net481 (in legacy non sdk project file)) since all the time behavior is the same:
1. Class is not found
2. Specify the path to the nuget solution in the solution settings
3. Profit...
Looks like something is missed
Upvotes: 2
Views: 137