MiniScaffold icon indicating copy to clipboard operation
MiniScaffold copied to clipboard

Trying to port a library fails because of linksource test

Open halcwb opened this issue 3 years ago • 10 comments

Describe the bug I am trying to port an existing project to the MiniScaffold setup. I could create an empty scaffold project. But with my Utils.Lib I can't pass the sourcelink test. Somehow it doesn't add the urls and I get:

dotnet sourcelink test dist/Informedica.Utils.Lib.1.0.0.nupkg 17 Documents without URLs: 896fe14a8198e001d6414c79143ed01313cd0420332dd3def8b4362561c076db sha256 fsharp C:\Development\Informedica\libs\Informedica.Utils.Lib\src\Informedica.Utils.Lib\App.fs bee40b116ca2c6d0e8ef3232a53246f3076da740a6449b900a9ddf786937e684 sha256 fsharp C:\Development\Informedica\libs\Informedica.Utils.Lib\src\Informedica.Utils.Lib\File.fs etc...

To Reproduce Steps to reproduce the behavior:

  1. clone the https://github.com/informedica/Informedica.Utils.Lib
  2. run the sourcelinktest target
  3. See error

Expected behavior The git urls attached to the sources in the pdb file.

Any help greatly appreciated. Spend already some hours searching for a solution, but very little to go on.

halcwb avatar Jan 19 '21 17:01 halcwb

I don't have a solution off the top of my head. This would be a better issue for the sourcelink repo.

TheAngryByrd avatar Jan 19 '21 17:01 TheAngryByrd

By the way, as I understand it, using snupkg is the recommended way to enable source link:

<Project>
  <PropertyGroup>
    <!-- Optional: Declare that the Repository URL can be published to NuSpec -->
    <PublishRepositoryUrl>true</PublishRepositoryUrl>

    <!-- Optional: Embed source files that are not tracked by the source control manager to the PDB -->
    <!-- This is useful if you generate files during the build -->
    <EmbedUntrackedSources>true</EmbedUntrackedSources>
  </PropertyGroup>

  <ItemGroup>
    <!-- Generate symbol packages (.snupkg) -->
    <!-- You must publish both packages, the package that contains the dll (.nupkg) and the one that contains the symbols (.snupkg) -->
    <IncludeSymbols>true</IncludeSymbols>
    <SymbolPackageFormat>snupkg</SymbolPackageFormat>

    <!-- Required -->
    <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-*" PrivateAssets="All"/>

    <!-- Required if your repository is on VSTS -->
    <!--<PackageReference Include="Microsoft.SourceLink.Vsts.Git" Version="1.0.0-*" PrivateAssets="All"/>-->

    <!-- Required if your repository is on GitLab -->
    <!--<PackageReference Include="Microsoft.SourceLink.GitLab" Version="1.0.0-*" PrivateAssets="All"/>-->
  </ItemGroup>
</Project>

halcwb avatar Jan 20 '21 07:01 halcwb

Don't use snupkg, it's so much work for so little reward. Just embed the pdb into your dll using <DebugType>embedded</DebugType> and enjoy. Not all tooling knows how to use snupkg, but all tooling can handle embedded pdbs.

baronfel avatar Jan 20 '21 13:01 baronfel

I'm not sure if this is a proper solution, but I had the same issue earlier today and I solved it by adding:

<DebugType>embedded</DebugType>
<EmbedAllSources>true</EmbedAllSources>

to my project file.

Using <DebugType>embedded</DebugType> alone did not help...

JohnTheGr8 avatar Jan 21 '21 03:01 JohnTheGr8

In my understanding, you'll want to use EmbedAllSources true if you're making use of the auto-generated AssemblyInfo.fs files. If you're generating via some other mechanism or handwriting those, then they'll just be source files in your repository already and you won't need it.

baronfel avatar Jan 21 '21 04:01 baronfel

I think it's time we remove that tool. While it did seem useful, it hasn't gotten updates in years at this point.

TheAngryByrd avatar May 28 '21 13:05 TheAngryByrd

Asked about an equivalent on the SourceLink repo. We'll either move to that or remove it from the tool chain.

TheAngryByrd avatar May 28 '21 13:05 TheAngryByrd

It’s WIP currently https://github.com/dotnet/sourcelink/pull/678

TheAngryByrd avatar May 28 '21 18:05 TheAngryByrd

Is there any work continuing on this? Just made a new project and first time trying to get it to publish to nuget (first package upload was done by hand). I'm not sure if my issue falls under this mini-scaffold issue or not. This is a fresh miniscaffolded project created today.

Finished (Success) 'DotNet:pack' in 00:00:05.5794834
Finished (Success) 'DotnetPack' in 00:00:05.5811715
Starting target 'SourceLinkTest'
C:\projects\ToMEHelper> "C:\Program Files\dotnet\dotnet.EXE"  sourcelink test "C:\projects\ToMEHelper\dist\ToMEHelper.0.1.1.nupkg" (In: false, Out: false, Err: false)
1 Documents with errors:
8c5cb62950a93ded73ce3fbc4752ae76b1a256f713862d446fc29fc045269ed8 sha256 fsharp C:\projects\ToMEHelper\src\ToMEHelper\Schema.fs
https://raw.githubusercontent.com/ImaginaryDevelopment/ToMEHelper/88e7d0d3c17af54acdccdf7f8e9b3f300543c273/src/ToMEHelper/Schema.fs
error: url hash does not match: 8c5cb62950a93ded73ce3fbc4752ae76b1a256f713862d446fc29fc045269ed8
sourcelink test failed
failed for lib/net5.0/ToMEHelper.pdb
1 files did not pass in C:\projects\ToMEHelper\dist\ToMEHelper.0.1.1.nupkg
Finished (Failed) 'SourceLinkTest' in 00:00:01.2437369

ImaginaryDevelopment avatar Dec 15 '21 19:12 ImaginaryDevelopment

Since this is an upstream problem, the only thing you can do as of right now is to remove the target.

TheAngryByrd avatar Dec 15 '21 19:12 TheAngryByrd