Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET Core 3.1 single file exe with libgit2sharp throws error #1754

Closed
SIkebe opened this issue Jan 21, 2020 · 8 comments
Closed

.NET Core 3.1 single file exe with libgit2sharp throws error #1754

SIkebe opened this issue Jan 21, 2020 · 8 comments

Comments

@SIkebe
Copy link

SIkebe commented Jan 21, 2020

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-download
@alexriedl
Copy link

alexriedl commented Jan 28, 2020

This affects me too. Happens on dotnet core 3.0 and 3.1 on windows 7 and 10

@SIkebe
Copy link
Author

SIkebe commented Jan 28, 2020

Are there any workaround?

@hideintheclouds
Copy link

hideintheclouds commented 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
Copy link

In my very limited testing that seems to make it work!

@bording
Copy link
Member

bording commented 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
Copy link
Author

SIkebe commented 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
Copy link
Member

bording commented 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.

@bording bording closed this as completed Jan 30, 2020
@aaronhudon
Copy link

For those not following too closely, but receiving this error, add the following to your .csproj

  <PropertyGroup>
    <IncludeSymbolsInSingleFile>true</IncludeSymbolsInSingleFile>
  </PropertyGroup>

Viir added a commit to pine-vm/pine that referenced this issue May 18, 2020
With the previous version, got this error when trying to run elm-fullstack.exe:
----
Error:
  An assembly specified in the application dependencies manifest (elm-fullstack.deps.json) was not found:
    package: 'LibGit2Sharp.NativeBinaries', version: '2.0.306'
    path: 'runtimes/win-x64/native/git2-106a5f2.pdb'

For context, see:

+ libgit2/libgit2sharp#1754 (comment)
+ dotnet/sdk#3685
Noggog added a commit to Mutagen-Modding/Synthesis that referenced this issue Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants