Using an assembly that has a different processor architecture than your web project may cause your application to throw compatibility errors. Imagine your ASP.NET application targets 32-bit processors but you try to reference a 64-bit Oracle.DataAccess.dll. You will receive an error message such as “Could not load file or assembly” or “Provider is not compatible“.
In order to fix compatibility errors, you need to make sure the processor architecture of your assembly files (dll files). This seems like a complicated task but it’s actually pretty straightforward if you know where to look at.
I will explain 5 quick ways to find out the processor architecture of an assembly file.
Are you looking for how to find public key token value of an assembly file. Check this post out.
5 ways to find out the processor architecture of an assembly file
1. Use Notepad
Yes, it’s as easy as using Windows Notepad. Follow the steps below:
- Open Notepad (Start > Search > Notepad)
- Go to “File > Open”
- Select “All files” from the drop-down list
- Select the file
- Find the letters PE. Check the letter next to it
- If it is PE L, it’s 32-bit (x86)
- If it is PE d†, it is 64-bit (x64)
Thank you Alexander Revo for this brilliant method.
2. Use 7-Zip
Another easy way of finding out processor type is that using 7-Zip which is a popular file achiever that is installed in majority of users. Follow easy the steps below.
- Right click the file. Click “7-Zip > Open archive”
- Click “Info” (yellow icon on the top menu)
- You will see the processor information next to “CPU:”
3. Use Dumpbin
If you have Visual Studio installed, you can use Dumpbin utility to display properties of your assembly files. Make sure to use it with /headers option. Follow the steps below to use Dumpbin:
- Go to “Start > Visual Studio > Visual Studio Tools > Developer Command Prompt”
- Run the command below. Make sure the specify correct path of your DLL file
dumpbin /headers Oracle.DataAccess.dll
4. Use Sigcheck
Another useful Microsoft utility is Sigcheck. You can download it quickly from Microsoft’s website. Follow the steps below to use Sigcheck for finding processor architecture of your dll and exe files.
- Download Sigcheck and unzip it
- Open Command Prompt and go to the path of the unzipped folder
- Run the command below
sigcheck Oracle.DataAccess.dll
5. Use Dependency Walker
My last recommendation is a third-party tool: Dependency Walker. It’s a free utility to view properties of your dll, exe, and other Windows modules. It creates a hierarchical tree diagram for the file you select.
- Download and run Dependency Walker
- Go to “File > Open” and select the file
- Look for CPU column (It may give an error for 32-bit files. Click “OK” and check the result window)
References: