Problems with the library IFilter - c#

I want to use the IFilter interface to extract and then search the text from different documents. The IFilter interface fits this need perfectly, but there is an issue with 32/64 bit components.
The host OS is 64-bit. The application is 32-bit. I want to extract text from a .docx file, so I try to install the 32-bit Office 2010 Filter Pack. The installer fails with a message: 'The MSI Installer type does not match the platform architecture.'
When I install the 64-bit version of the Filter Pack, the 32-bit dlls are not installed so the filters are still not available. How do I install the 32-bit filters on a 64-bit system? it's possible ?
Thanks a lot in advance

There is no support for installing the 32-bit filters on 64-bit Windows. The only solution you have is to install the 64-bit filters and create a 64-bit out-of-proc COM server application that exposes the functionality you require. This app could load the 64-bit filters and COM would handle the inter-process communication between your 32-bit app and the 64-bit out-of-proc COM server.

I found a way to install Filter Pack 32bits in a 64bits OS. To other file formats is similar.
Install Filter Pack 32 bits in a 32bits OS.
Copy ifilters files in directory “C:\Program Files\Common Files\Microsoft Shared\Filters” from 32 bits OS to the a directory “C:\Program Files (x86)\Common Files\Microsoft Shared\Filters” in 64bits OS.

Related

The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine while data export to MS ACCESS

I am beginner in using Microsft.ACE.OLEDB 12.0. I create a Winforms application VS 2010.
And create a function for export data grid data to MS Access file. I using Microsoft Oledb
for export the data grid data to MS Access file.But i get this error when i try to export
the
data to ms access.
Please see the below image.
I also refer the Microsoft.Office 12.0 Object Library in my application.
Batch Build Configuration
The reference to the Access Interop bits has nothing to do with your exception and Access Interop is not necessary to use the classes in the System.Data.OleDb.
The problem arises when you have your application compiled for AnyCPU Platform, you are running on a 64bit system and the installed ADO.NET provider (Microsoft ACE.OLEDB.12.0) is the 32bit version.
When using the AnyCpu target Platform your code will be executed as 64bit code on 64bit systems and as 32bit code on 32bit systems. An application executed as 64bit cannot use 32bit drivers (and viceversa). Now add to the mix the fact that Microsoft.ACE.OLEDB.12.0 has two different versions. One for 64bit and and one for 32bit and they cannot be installed together on the same machine.
The simplest workaround is to change the Target Platform of your application through Visual Studio menu
BUILD -> Configuration Manager -> Active Solution Platform -> x86
If the x86 option is not already there, then select NEW, name it x86, Copy Settings from AnyCPU and check Create new project platforms
If you think that using a 32bit app on a 64bit Operating System is a loss of performance or something to be avoided then think twice and read this reference where the PRO and CONS of AnyCpu are critically examined. If you don't have a specific reason to use AnyCpu it is better to stay with x86.
Of course, another option is to deinstall the 32bit version and install the 64bit version of ACE from here and then run you application as AnyCpu on 64bit systems. But this could be a nightmare for your deployment scenarios. What if Microsoft Office 32bit version is installed on your x64 target machine? Office installs its bit compatible version of ACE and, as said, it is not possible to have 32bit and 64bit of ACE installed on the same machine.
Now you should also ask your customer to reinstall Office as 64bit to keep your 64bit app happy.
UPDATE
The situation has changed a bit with the newest versions of Visual Studio. There is now a new option that is the default for new projects. It is called AnyCPU Prefer 32bit mode. More details at this link: What AnyCPU Really Means As Of .NET 4.5 and Visual Studio 11 and another interesting post (albeit regarding Sql Server Compact) is this one The trouble with Any CPU–Prefer 32 bit–BadImageFormatException
Change in its App pool 'advanced settings' to allow to run 32-bit programs... that did it for me.
I have similar issue when we are reading Excel file.
History of the problem:
We recently migrated our application from 32-bit to 64-bit because of the memory requirement. For that we migrated our windows 7 from 32-bit to 64-bit. But still we installed 32-bit office on our machines.
because, of this we had this issue while importing Excel data into application.
Solution,
I downloaded 64-bit version of the http://www.microsoft.com/en-us/download/details.aspx?id=13255 and installed with argument as,
AccessDatabaseEngine_x64.exe /passive
Without any code change my issue get resolved.
Note:
On 64-bit OS and 64-bit office, my functionality was working fine without this fix. This fix is only required while our application is 64-bit running on 64-bit OS which is having 32-bit office installed on it.
Base way:
Application : MVC C#,
For Win Server 64 bit:
Remove all office 32 bit installed.
Download link: https://www.microsoft.com/en-us/download/details.aspx?id=13255
select download 64 bit and then install it to server(If you can't setup program. Please re-check 1 point).
retry access your application again.enter image description here
for me installing Microsoft Access Database Engine 2010 Redistributable fixed the problem, the 32 bit version.
In my case
Download link: https://www.microsoft.com/en-us/download/details.aspx?id=13255
Select download 32 bit and then install it to server(Even if your server is 64-bit)
If you can't setup program uninstall 64 bit version.
Retry access your application again
If you have still error(Set Enable 32-bit Applications to True for your application in IIS)

32 bit winform application doesn't run on 64 bit OS

I have two laptops.
1) BuildLaptop-> The laptop that I have coded the application. Windows 7 Ultimate 32-bit, Office 2007 for database
2)TestLaptop-> To test the application. Windows 7 ultimate 64 bit, Office 2007.
My application contains several dll files that built as AnyCPU and the application is also built as AnyCPU.
When I tried to test my application on TestLaptop it gave me an error:
Microsoft.ACE.OleDb.12.0 provider is not registered on your machine.
So I uninstalled Office from TestLapTop and installed the Office as on BuildLapTop.
Again same error. Then I tried to compile all dlls and also my application to x64. The application could not start. Then I tried to compile only application to x64 and dlls to anyCPU. The error occured again.
So help me how to get my application run on the TestLapTop?
You need to compile any project as /platform:x86 if it uses any 32-bit unmanaged resources (DLL's, etc).
I'm not sure based on your comment you may be experiencing this issue. If you have any Microsoft Office programs installed:
Word
Outlook
Excel
Powerpoint
Etc
If they are the 32 Bit Revision then you can't install a 64 Bit Access Database Engine it will give you the following exception:
This will force you to install the 32 Bit Revision onto your 64 Bit Machine. You may also require some additional configuration for the database in your ODBC Data Source through Administrative Tools.
Hopefully that clarifies at least your error you mentioned in comment. As for the compile, Sixlettervariables has a solution for that.
Hopefully that helps though.

What does the ProgramFilesX86 SpecialFolder do on systems like Windows XP?

Since I can't find anything clearly stating it on the MSDN documentation: what does the ProgramFilesX86 enum value return on 32-bit systems?
Development Environment
Please note: in my organization I can't just stand up machines whenever I want to test things. This is why I'm asking the community. I don't even have access to 32-bit ISO's to build a virtual machine -- so please understand I have some limitations inside this organization.
Windows 7 64-bit
Production Environment
In production I don't know if they are running 32 or 64-bit systems, and it's likely a mixture. However I do know the list of operating systems.
Windows 7
Windows Vista
Windows XP
Objective
Get the correct program files directory so I can launch my application dynamically.
Known Variables
The application is installed with an MSI, and it will be installed with the default options, so it will be installed in the Program Files directory.
The application is a 32-bit application, so on 64-bit systems it will use the Program Files (x86) folder, but on 32-bit systems it will use the standard Program Files directory.
Thanks all!
32-bit XP: an empty string :(
32-bit Vista: "C:\Program Files"
32-bit Win7: not tested, probably same as Vista
64-bit Win7: "C:\Program Files (x86)"
Not sure about 64-bit XP, I am curious myself.
The Remarks section for KNOWNFOLDERID contains a handy table giving you the information you seek (from an unmanaged perspective). It's tricky to reproduce it here:
OS App KNOWNFOLDERID Default CSIDL
32 bit 32 bit FOLDERID_ProgramFilesX86 %SystemDrive%\Program Files CSIDL_PROGRAM_FILESX86
64 bit 64 bit FOLDERID_ProgramFilesX86 %SystemDrive%\Program Files (x86) CSIDL_PROGRAM_FILESX86
64 bit 32 bit FOLDERID_ProgramFilesX86 %SystemDrive%\Program Files (x86) CSIDL_PROGRAM_FILESX86
It returns "Program Files". Since you're installing using an MSI, you might consider using the installer APIs (MsiLocateComponent, and so on) to locate your program instead of assuming it's in the expected location.
On my Win 7 32-bit system ProgramFilesX86 returns C:\Program Files (no trailing slash).
Console.WriteLine("GetFolderPath: {0}", Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86));

Is it OK to manually write Wow6432Node entries from VS2010 Deployment Project?

I have a .NET component written in C# that needs to register some registry values under the HKLM hive. I'm expecting this component to be installed on both x86 (32-bit) and x64 (64-bit) boxes running the appropriate flavour of Windows. On 64-bit systems, I want to make sure the component can be used by both 32- and 64-bit hosting processes. I'm stuck with using Visual Studio's deployment projects for the time being.
What I want is for my installer, when run on 64-bit systems, to put its registry entries under HKLM/Software/Blablah, so that when running in a 64-bit process, my component can find its global configuration settings. However, if my component is hosted by a 32-bit process running on the same machine, then it will read from what it thinks is the same key, but which Wow64 will translate to HKLM/Software/Wow6432Node/Blablah.
Is it OK to author my 64-bit installer so that:
it is marked as a x64 installer
it writes the entries under HKLM/Software/Blablah for the benefit of 64-bit processes
it writes exact copies of those entries under
HKLM/Software/Wow6432Node/Blablah for the benefit of 32-bit processes on the same machine.
I'm guessing that because I've marked the installer as x64, I will be forced to author another separate installer specifically for 32-bit systems, which only writes to HKLM/Software/Blablah.
The normal practise is to have both 32 bit and 64 bit install packages. On the 32 bit machine you just run the 32 bit package, on the 64 bit machine you run both.
Trying to handle all the registry and file redirection yourself is a nightmare and it's much better to install a 32 bit package on a 64 bit machine and let the system do the redirection for you. You've got to produce the 32 bit package anyway for 32 bit machines, so it's no extra work.

How can I start ServerManager.msc on a 64bit Windows Server 2008 from a 32bit .NET App?

I have the following scenario:
- 64bit Windows Server 2008.
- 32bit .NET application (needs to be x86 for various reasons).
- I need to start ServerManager.msc from my .NET application.
When using Process.Start("ServerManager.msc"), I get the following exception:
System.ComponentModel.Win32Exception.
Message="The system cannot find the file specified".
On a 32bit Windows Server 2008 the code works fine...
I tried to inlcude the full path to ServerManager.msc, but that does not help either.
Also no difference if running with or without admin privileges.
Any ideas?
On WOW64, if a 32-bit application refers to C:\Windows\System32; the operating system transparently remaps this to C:\Windows\SysWOW64 (which is where the 32-bit stuff lives).
As a 32-bit application on Win64, you need to specify the full path as %SYSTEMROOT%\SysNative\ServerManager.msc.
SysNative doesn't exist on x86 Windows (there's no reverse mapping, at least on Win7 Ultimate), so you'll need to figure out whether you're on x86 or x64 first.
Please use depends.exe to find out which file/dll is missing.
If it is using an x86 native dll/library which is compiled in newer version of VC++ Runtime. Install the latest VC++ runtime on the 2008 server. Latest I believe is 2008 SP1.

Categories

Resources