aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/AssemblyNameReader.cs24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/AssemblyNameReader.cs b/src/WixToolset.Core.WindowsInstaller/Bind/AssemblyNameReader.cs
index 2f38fc68..2103cd32 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/AssemblyNameReader.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/AssemblyNameReader.cs
@@ -29,7 +29,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
29 29
30 var name = ReadString(reader, assembly.Name); 30 var name = ReadString(reader, assembly.Name);
31 var culture = ReadString(reader, assembly.Culture); 31 var culture = ReadString(reader, assembly.Culture);
32 var architecture = headers.PEHeader.Magic == PEMagic.PE32Plus ? "AMD64" : (headers.CorHeader.Flags & CorFlags.Requires32Bit) == CorFlags.Requires32Bit ? "x86" : (headers.CorHeader.Flags & CorFlags.ILOnly) == CorFlags.ILOnly ? "MSIL" : null; 32 var architecture = ArchitectureFromHeaders(headers);
33 var version = assembly.Version.ToString(); 33 var version = assembly.Version.ToString();
34 var publicKeyToken = ReadPublicKeyToken(reader, assembly.PublicKey); 34 var publicKeyToken = ReadPublicKeyToken(reader, assembly.PublicKey);
35 35
@@ -144,6 +144,28 @@ namespace WixToolset.Core.WindowsInstaller.Bind
144 return new AssemblyName(win32Name, null, win32Version, null, win32ProcessorArchitecture, win32PublicKeyToken, win32Type); 144 return new AssemblyName(win32Name, null, win32Version, null, win32ProcessorArchitecture, win32PublicKeyToken, win32Type);
145 } 145 }
146 146
147 private static string ArchitectureFromHeaders(PEHeaders headers)
148 {
149 if (headers.PEHeader.Magic == PEMagic.PE32Plus)
150 {
151 return "AMD64";
152 }
153 else if ((headers.CorHeader.Flags & CorFlags.Requires32Bit) == CorFlags.Requires32Bit)
154 {
155 return "x86";
156 }
157 else if ((headers.CorHeader.Flags & CorFlags.ILOnly) == CorFlags.ILOnly)
158 {
159 return "MSIL";
160 }
161 else
162 {
163 // We return "x86" here because that seems to best match the Fusion-based
164 // GetAssemblyIdentityFromFile() method of acquiring the assembly identity.
165 return "x86";
166 }
167 }
168
147 private static string ReadString(MetadataReader reader, StringHandle handle) 169 private static string ReadString(MetadataReader reader, StringHandle handle)
148 { 170 {
149 return handle.IsNil ? null : reader.GetString(handle); 171 return handle.IsNil ? null : reader.GetString(handle);