guna Samba
guna Samba

Reputation: 484

Read Excel files from C# in 64 bit version server

reading excel files from C# working well in 32 bit version server. It is not working in 64 bit version (Windows 2003 server), because excel data connection dll not supported in 64 bit version. Is any other option available ?

Upvotes: 2

Views: 6157

Answers (1)

Dirk Vollmar
Dirk Vollmar

Reputation: 176159

In your project properties set the target platform from 'Any' to 'x86'.

Details:

In Windows x64 a process may be started as 32bit or 64bit process. A 64bit process can only load 64bit dlls and a 32bit process only 32bit dlls.

If your platform target (e.g. specified in the project properties) of your .Net application is set to "Any CPU", the intermediate code will be compiled to 32bit or 64bit code depending on the target platform, i.e. on a x64 system 64bit code will be generated.

Therefore the code can no longer load a 32bit dll.

If your code loads unmanaged assemblies you should always specify the target platform explicitly

Upvotes: 5

Related Questions