dotnet / reproducible-builds

Contains the DotNet.ReproducibleBuilds package
MIT License
168 stars 18 forks source link

Build warning: "Source control information is not available - the generated source link is empty" #13

Open nathan-alden-hp opened 2 years ago

nathan-alden-hp commented 2 years ago

This warning message isn't very informative, so I don't know what conditions to resolve.

I borrowed a method for referencing packages in SDK-style from Tanner Gooding to prevent developers from accidentally removing important package references. I have a solution with cascading Directory.Build.props and Directory.Build.targets files. In my repo's source/Directory.Build.props file, I initially define the NuGet package reference in SDK style:

<ItemGroup Condition="'$(Configuration)' == 'Release'">
  <!-- IsImplicitlyDefined causes Visual Studio to treat this package as an SDK package, meaning developers cannot accidentally remove it -->
  <PackageReference Include="DotNet.ReproducibleBuilds" IsImplicitlyDefined="true" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers" />
</ItemGroup>

Then, in source/Directory.Build.targets, I define the version numbers used by the package:

<ItemGroup Condition="'$(Configuration)' == 'Release'">
  <PackageReference Update="DotNet.ReproducibleBuilds" Version="0.1.66" />
</ItemGroup>

I originally defined <RepositoryUrl> myself in the root Directory.Build.props (imported before source/Directory.Build.props), but I took that out thinking its presence might have been causing the problem. It didn't help.

I also unsuccessfully tried referencing the package as normal inside source/Directory.Build.props:

<PackageReference Include="DotNet.ReproducibleBuilds" Version="0.1.66" />

Git shows the correct origin URL:

> git remote get-url origin
https://redacted/redacted.git

I am not sure what else to try.

nathan-alden-hp commented 2 years ago

Investigating this: https://github.com/dotnet/sourcelink/issues/488

MattKotsenas commented 5 hours ago

Hi @nathan-alden-hp! As suggested in your later comment, this appears to be a SourceLink issue. We recently released a new version of reproducible-builds that includes a newer version of SourceLink. Would you mind updating and seeing if this issue still repos?