diff options
author | jbevain <jbevain@gmail.com> | 2011-07-23 18:57:34 +0400 |
---|---|---|
committer | jbevain <jbevain@gmail.com> | 2011-07-23 19:35:46 +0400 |
commit | 6ec74ffda4cb342507bc13acba0faf31341723f1 (patch) | |
tree | db1b9268729aaa35642c1d02d621be295a31ffce /Mono.Cecil | |
parent | 81df043ce6640a4f2fb963e83120013c69803de3 (diff) |
cleanup assembly name when created from scratch
Diffstat (limited to 'Mono.Cecil')
-rw-r--r-- | Mono.Cecil/ModuleDefinition.cs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Mono.Cecil/ModuleDefinition.cs b/Mono.Cecil/ModuleDefinition.cs index ecfbf82..107a1dd 100644 --- a/Mono.Cecil/ModuleDefinition.cs +++ b/Mono.Cecil/ModuleDefinition.cs @@ -835,7 +835,7 @@ namespace Mono.Cecil { if (parameters.Kind != ModuleKind.NetModule) { var assembly = new AssemblyDefinition (); module.assembly = assembly; - module.assembly.Name = new AssemblyNameDefinition (name, new Version (0, 0)); + module.assembly.Name = CreateAssemblyName (name); assembly.main_module = module; } @@ -844,6 +844,14 @@ namespace Mono.Cecil { return module; } + static AssemblyNameDefinition CreateAssemblyName (string name) + { + if (name.EndsWith (".dll") || name.EndsWith (".exe")) + name = name.Substring (0, name.Length - 4); + + return new AssemblyNameDefinition (name, new Version (0, 0)); + } + #endif public void ReadSymbols () |