Build fails after including a library built with SourceLink
See original GitHub issueI have a .NET Framework 4.7 project with a NuGet package reference of a .NET Standard 2.0 library I built with SourceLink. The build fails with:
C:\mysolution\packages\Microsoft.Build.Tasks.Git.1.0.0-beta-62925-02\build\Microsoft.Build.Tasks.Git.targets(20,5): error : Unable to locate repository containing directory ‘C:\mysolution\myproject’
This is due to the project I am trying to build not being under git source control.
To make this build I had to include the following in my project file:
<PropertyGroup>
<RepositoryType>hg</RepositoryType>
</PropertyGroup>
This means that for anyone using my NuGet package, they would either need to be using git or make the manual change to their project file.
Here is where it defaults to git: https://github.com/dotnet/sourcelink/blob/74fc354e81dc6b7b33596c4f20a926c71ed41a68/src/Microsoft.Build.Tasks.Git.Operations/build/Microsoft.Build.Tasks.Git.targets#L24-L26
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
I don’t think
Install-Package
sets thePrivateAssets
metadata.Despite adding PrivateAssets=“All”, i am still getting “Unable to locate repository”.
The configuration i had in my csproj are as follows :-
<PackageReference Include="Microsoft.SourceLink.GitLab" Version="1.0.0-beta-63127-02"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>