8000 NativeMethods - Wrong originalAssemblypath · Issue #202 · libgit2/libgit2sharp · GitHub
[go: up one dir, main page]

Skip to content
NativeMethods - Wrong originalAssemblypath #202
Closed
@Danielku15

Description

@Danielku15

Your method of determining the assembly path is not working all the time. An example is: If you have a # sign in your path, it will get stripped off by the Uri:

string codeBase = Assembly.GetExecutingAssembly().CodeBase; // "file://D:/Dev/C#/Projects/../../Test.exe"
string originalAssemblypath = new Uri(codeBase).LocalPath; // "D:\Dev\C"

You should use this method of getting the location:

string originalAssemblypath = new FileInfo(Assembly.GetExecutingAssembly().Location).DirectoryName

The location attribute stores a more system friendly path to the running executable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0