SourceLink doesn't work well with WPF projects
See original GitHub issueError
Microsoft.Managed.Core.targets(90,5): SourceRoot items must include at least one top-level (not nested) item when DeterministicSourcePaths is true [C:\Temp\WpfApp1\WpfApp1\WpfApp1_3qoc4wf0_wpftmp.csproj]
is reported when building with /p:ContinuousIntegrationBuild=true
.
Due to https://github.com/NuGet/Home/issues/5894 - WPF projects do not import .props and .targets files from NuGet packages.
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Link /SOURCELINK option seems to do nothing
We are using SourceLink with c# projects and it is working just fine. When we try to use it on C++ projects the...
Read more >View Source link does not work in Live Visual Tree ...
View Source link does not work in Live Visual Tree, Visual Studio 2017 ... Create WPF project, mine includes custom dialogs and buttons...
Read more >Debug NuGet packages with SourceLink (no symbols package!)
WindowsDesktop” SDK) so I have moved our “WPF Components” package to .Net Core 3 too. Once we have installed the “Microsoft.SourceLink.Tfs.Git” ...
Read more >Debugging External Sources with Visual Studio
This node appears while debugging and will show sources for managed modules with symbols loaded containing Source Link or Source Server ...
Read more >How to debug NuGet packages using SourceLink
SourceLink is very simple to enable in your build. All you have to do is to add a reference to the NuGet package...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The issue in Newtonsoft.Json is related but different than the WPF issue.
When
DeterministicSourcePaths
is enabled the compiler needs to know the set of directories that all source code resides under. This set is specified bySourceRoot
items. In projects that reference SourceLink packageSourceRoot
items are populated by SourceLink since it knows where the repository root is.In projects that do not reference SourceLink package this
SourceRoot
is undefined and hence the compiler doesn’t know how to normalize the paths and reports the error [1].The recommendation is to include the SourceLink package reference to all projects in the repo (even to test projects). This can be easily accomplished via adding
Directory.Build.props
file in the root of the repository that includes the SoruceLink package:[1] The compiler does not infer the source root(s) based on source file paths it is given as this might produce confusing results. Consider a repo with two projects:
If the compiler inferred the source roots for these projects they would be
.../src/ProjectA/
and.../src/ProjectB/
and the paths embedded in DLLs and PDBs toProgram.cs
files would be/_/Program.cs
for both.../src/ProjectA/Program.cs
and.../src/ProjectB/Program.cs
. So it would be impossible to distinguish whichProgram.cs
is which.The workaround is to add
to the .csproj file.