我只需要在我的C#代码中搜索文本片段。
我已经有了.NET Reflector和文件反编译器插件,但这些似乎只能反编译一个DLL。
我只需要在我的C#代码中搜索文本片段。
我已经有了.NET Reflector和文件反编译器插件,但这些似乎只能反编译一个DLL。
dll
中定位特定指令(特别是使用反射),则可以使用此 PowerShell 脚本将 dll
反编译为 IL 并查找指令 (System.Reflection.Assembly::Load(string)
用于反射)。function Get-LibDump
{
Param(
# Specifies a path to one or more locations. Wildcards are permitted.
[Parameter(Mandatory=$true,
Position=0,
ParameterSetName="Basic",
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true,
HelpMessage="Path to one or more locations.")]
[ValidateNotNullOrEmpty()]
[SupportsWildcards()]
[ValidateScript({$_ | Test-Path})]
[System.IO.FileInfo]
$Path
)
process
{
$dumpFileFilePath = $Path.BaseName + '.il'
$outFile = "C:\LibDump\$dumpFileFilePath"
Start-Process -FilePath 'c:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools\ildasm.exe' -ArgumentList "/UNICODE /OUT=`"$outFile`" `"$($Path.FullName)`"" -Wait
"Dump from:`n$(Resolve-Path -Path $Path.FullName -Relative)" | Out-File -FilePath $outFile -Encoding:unicode -Append
}
}
# Use
Get-ChildItem -Path $PathToLibFolder -Filter '*.dll' -File -Recurse | Get-LibDump