Saturday, February 25, 2012

"Class not registered" with RMO and x64 Windows

I have a small .net application that uses RMO to synchronize a merge subscription. Everything works fine when I build with platform target = "Any CPU" on both x86 and x64 systems, but I get a "Class not registered" error on my x64 system when the application is built with platform target = "x86". Incase you are wondering I have to run this code under x86 because it is actually going to distributed in a dll and called from an x86 application.

x64 System:

Microsoft Windows Server 2003 R2

Enterprise x64 Edition

Service Pack 1

Here is my code:

{
ServerConnection dbconn = new ServerConnection(publication_server);
dbconn.LoginSecure = true;
dbconn.Connect();

MergeSubscription subscription = new MergeSubscription();
subscription.ConnectionContext = dbconn;
subscription.DatabaseName = publication_db;
subscription.PublicationName = publication_name;
subscription.SubscriberName = subscription_server;
subscription.SubscriptionDBName = subscription_db;

if (!subscription.LoadProperties() || subscription.SubscriberSecurity == null)
throw new Exception("Unable to initialize the Synchronization");

MergeSynchronizationAgent agent = subscription.SynchronizationAgent;
agent.Synchronize();
}

The MergeSynchronizationAgent class is platform specific (it is just a thin wrapper around a pile of native code), so you would need to make sure that you have the x86 version of SQL Server installed on your x64 server if you compile your exe as x86.

-Raymond

|||

I would hate to install an x86 instance of SQL Server to solve this issue. Is there anything short of that I can do to get the appropriate files and registry keys on to an x64 system?

Thanks for your help.

|||

Sorry to disappoint you, but there really isn't a supported way to allow you to just pick the dependencies for running the MergeSynchronizationAgent class although we have plans to come up with a merge module for replication components in the future. Realistically, it would be rather difficult to just pick out the dependencies for the MergeSynchronizationAgent class as it depends on things that folks normally don't suspect such as:

sqlncli.dll\rll

msvc80*.dll

The 2.0 .NET Framework

instapi.dll under 90\Share and corresponding registry key for locating it.

-Raymond

No comments:

Post a Comment