Giter VIP home page Giter VIP logo

sharppdbpatcher's Introduction

SharpPdbPatcher

A library/console program to replace source paths stored in a .NET PDB file.

Applications

PDB for Program DataBase is used to store various information useful for debugging. For each methods/functions in your program, the PDB is storing the exact location to the source code on your disk in an absolute form.

When you want to deploy/distribute a .NET assembly and pdb along your sources, but you don't want to use a symbol server or recompile the assemblies on the target machine, this library allows to patch the PDBs files and replace the location.

This can be used for example in a nuget package instead of using a symbol server (like http://symbolsource.org) in order to provide directly sources along your assemblies. This patching can run at installation time through the use of a custom powershell install.ps1 script.

Command line Usage

   SharpPdbPatcher.exe --regex regexPattern --replace replaceString  file1.exe/dll [file2.dll...] | *.exe/dll

   --regex regexPattern    : Specify the regular expression to use when trying to match the source location
                             Warning: `\` should be escaped 
   --replace replaceString : Specify the replacement string when the regex pattern is matching
                             Warning: `\` should don't need to be escaped    

Note that the PDB must be placed in the same directory along the assembly.

Example to replace all paths starting with ".*TopDirectory\SubDirectory" by E:\NewTop\NewSub\:

   SharpDXPdbPatcher.exe --regex .*TopDirectory\\SubDirectory\\ --replace E:\NewTop\NewSub\ MyAssembly.dll

Library usage

   // Using a custom function
   PdbPatcher.Patch("MyAssembly.pdb", "MyAssemblyOutput.pdb", location => location.SubString(10)));

   // Or using regular expressions
   PdbPatcher.Patch("MyAssembly.pdb", "MyAssemblyOutput.pdb", new Regex(".*TotoDir\\TutuDir"), "Tata");

Disclaimer

Though this library has been tested on a set of assemblies, there is no full guaranty that the output PDB will work in all situations. Ensure that source code step-in is still working after patching your PDBs.

Credits

This library is using Mono.Cecil

Licensing

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.