Search code examples
c#azure-devops.net-standardsourcelink

Adding SourceLink nuget package causes build error


I've been following this documentation to enable SourceLink in an effort to be able to debug private nuget packages hosted on our Azure DevOps account, but have run into an issue.

The mere act of installing the appropriate nuget package (Microsoft.SourceLink.Vsts.Git) causes the build to fail with the following error:

1>vbc : error BC2001: file 'C:\Users\USER\AppData\Local\Temp\.NETStandard' could not be found
1>vbc : error BC2001: file 'C:\Projects\TheApp\TheLibrary\TheLibrary\Version=v2.0.AssemblyAttributes.vb' could not be found

This makes me think I'm missing some SDK or have the wrong version of VS2017, but it all seems ok: I'm on VS2017 15.8.7, have the .NET Core SDK 2.1.403 installed and the project is a .NET Standard 2.0 library.

Removing the nuget package makes the build pass again, but obviously removes the SourceLink support as well.


Solution

  • It turns out the issue was with the VB compiler. The SourceLink guide tells you that you can optionally include a <EmbedUntrackedSources>true</EmbedUntrackedSources> in the project file, but this causes the build to fail. An issue has been created to fix this in the compiler, but for now Microsoft advised me to just not inlcude that switch. Removing it let my build pass and SourceLink now works as advertised.