User Tools

Site Tools


notes:csharp:utils

.NET Utilities

ILDasm and .winmd files

You can open .winmd files with ILDasm.exe and explore their metadata.

Location of .winmd files in Windows 10:

C:\Program Files (x86)\Windows Kits\10\References

Location of .winmd files used by CLR at runtime:

C:\Windows\System32\WinMetadata

Location of ILDasm in Windows 10:

C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools

.NET versions

List installed .NET version:

cd %SystemRoot%\Microsoft.NET\Framework
dir

sample output (.NET folders):

v1.0.3705
v1.1.4322
v2.0.50727
v3.0
v3.5
v4.0.30319

gacutil

Example: Install an assembly in GAC as a post-build script in Visual Studio:

SET PATH="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin";%PATH
gacutil /u "$(TargetPath)"
gacutil /i "$(TargetPath)"

Example: Install and register an assembly in GAC:

cls
del *.tlb
gacutil /u MyAssembly
gacutil /i MyAssembly.dll
regsvcs MyAssembly.dll

csc

csc is the C# compiler.

Example: Copile a MyLib.cs file to a library. Reference an unmanaged DLL file and another assembly:

csc /target:library /platform:x86 MyLib.cs /LinkResource:unmanaged.dll /keyfile:key.snk /reference:AnotherAssembly.dll

sn

sn is the Strong Name tool.

Example: Generate a public/private key pair:

sn -k MyKey.snk

Example: View the public key of a signed assembly System.dll:

sn -Tp C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.dll

pdbcopy

pdbcopy is a part of the Debugging Tools for Windows.

A .NET PDB file contains two pieces of information:

  • source file names and their lines
  • local variable names

Example: Remove private information (such as the names of local variable) from a PDB file:

pdbcopy mysymbols.pdb publicsymbols.pdb -p
notes/csharp/utils.txt · Last modified: 2016/12/15 by admin