Repository navigation
.NET Core 3.1 single file exe with libgit2sharp throws error #1754
Copy link
Copy link
Closed
Description
Reproduction steps
mkdir Sample && cd Sample
dotnet new console
dotnet add package libgit2sharp
dotnet publish -c Release -r win-x64 --self-contained=true /p:PublishSingleFile=true
bin\Release\netcoreapp3.1\win-x64\publish\Sample.exe
Error:
An assembly specified in the application dependencies manifest (Sample.deps.json) was not found:
package: 'LibGit2Sharp.NativeBinaries', version: '2.0.306'
path: 'runtimes/win-x64/native/git2-106a5f2.pdb'using System;
namespace Sample
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}Sample.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="libgit2sharp" Version="0.26.2" />
</ItemGroup>
</Project>Expected behavior
Single file exe referencing libgit2sharp can run without error.
Actual behavior
Above error occurs.
Version of LibGit2Sharp (release number or SHA1)
0.26.2
Operating system(s) tested; .NET runtime tested
dotnet --info
.NET Core SDK (global.json を反映):
Version: 3.1.101
Commit: b377529961
ランタイム環境:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.101\
Host (useful for support):
Version: 3.1.1
Commit: a1388f194c
.NET Core SDKs installed:
2.2.203 [C:\Program Files\dotnet\sdk]
3.1.100 [C:\Program Files\dotnet\sdk]
3.1.101 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0-preview7.19365.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0-preview7-27912-14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0-preview7-27912-14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-downloadReacted by Ozlet, Alexander Trauzzi, Michael Rätzel and litetex
Reacted by Aaron Hudon and litetex
Metadata
Metadata
Assignees
Labels
No labels
Activity
alexriedl commentedon Jan 28, 2020
This affects me too. Happens on dotnet core 3.0 and 3.1 on windows 7 and 10
SIkebe commentedon Jan 28, 2020
Are there any workaround?
hideintheclouds commentedon Jan 29, 2020
Does setting /p:IncludeSymbolsInSingleFile=true work ?
I have found a similar issue here:
https://github.com/dotnet/core-setup/issues/8538
And a similar one:
https://www.gitmemory.com/issue/microsoft/onnxruntime/2591/566796454
alexriedl commentedon Jan 29, 2020
In my very limited testing that seems to make it work!
bording commentedon Jan 29, 2020
If you take a look at the files that are extracted when you run the exe, what does the file structure look like? It sounds like it's missing something.
SIkebe commentedon Jan 30, 2020
@hideintheclouds Thanks! The above property just worked.
It seems to be tracked here now. dotnet/sdk#3685
@bording As shown in my console output, git2-106a5f2.pdb is the one. Should I close this issue?
bording commentedon Jan 30, 2020
@SIkebe That does indeed seem to be the exact problem you're running into. Since it is a .NET Core bug, and there is a workaround, let's go ahead and close this issue.
aaronhudon commentedon Feb 4, 2020
For those not following too closely, but receiving this error, add the following to your .csproj
Fix single-file publishing for the CLI 🐛☠️
Explicit declaration of IncludeSymbolsInSingleFile