Could not load file or assembly 'RedGate.SQLCompare.Engine

Forum for users of SQL Toolkit 3,4,and 5

Could not load file or assembly 'RedGate.SQLCompare.Engine

Postby jprice2269 » Sun Dec 02, 2007 4:58 pm

I am trying to do a database compare, as soon as I instantiate any class that refers to the Redgate Toolkit, I get

Could not load file or assembly 'RedGate.SQLCompare.Engine, Version=6.2.1.36, Culture=neutral, PublicKeyToken=7f465a1c156d4d57' or one of its dependencies. An attempt was made to load a program with an incorrect format.

I dont get to execute any code, just inistantiate a class that refers to the dlls.

I have read other posts and have checked that all Dlls are coming from the same directory, In my case the SQL compare directory.

Its still a trial version, will buy it as soon as I can get it to sort of run, the actual compare tool itself still shows 14 days left, is this a licensing issue maybe?

Is this an issue with VS2008, which i'm using?

John Price
jprice2269
 
Posts: 7
Joined: Sun Dec 02, 2007 4:52 pm

Postby richardjm » Mon Dec 03, 2007 9:36 am

It could well be a problem with VS2008 as we've not done any testing with it yet. Try using VS2005 and see if it works.

HTH
Richard Mitchell
Project Manager
Red Gate Software Ltd
richardjm
 
Posts: 395
Joined: Fri May 20, 2005 9:44 am
Location: Red Gate Software Ltd

Postby Brian Donahue » Mon Dec 03, 2007 11:03 am

It sounds like it could be related to calling the 32-bit RedGate.SQLCompare.Engine.dll from an application that's 64-bit aligned. Is that possible?
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am

Postby jprice2269 » Mon Dec 03, 2007 6:37 pm

Yes, its possible, its running on a 64 bit machine with a CPU type of Any... That may be picking 64 as the default, it shouldnt be, but maybe it is.... Will try forcing to 32 bit and let your know...

If thats the case, is there a 64 version of the toolkit dlls, as the rest of the project takes advantage of 64 bit processors.... Shame to reduce that for this reason... and saves me having to to the work to split this process out of the main app!

Jp
jprice2269
 
Posts: 7
Joined: Sun Dec 02, 2007 4:52 pm

Postby Brian Donahue » Mon Dec 03, 2007 6:44 pm

Hi JP,

I'm sure it will work when set to 32-bit. CPU=Any will probably produce an executable that will run on 32-bit machines and not on 64-bit, well, at least when the code attempts to load the 32-bit SQLCompare dll.

We haven't split the assemblies into 32 and 64-bit versions as yet. I can't say if or when this would happen.
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am

Postby jprice2269 » Tue Dec 04, 2007 12:57 am

The 32 bit switch fixed that issue, however i now have a different problem.

I can connect to a sqlexpress database using the connectionstring

Data Source=.\\SQLEXPRESS;AttachDbFilename="QCM.mdf";Integrated Security=True;User Instance=True

however, when I call Register on the sqltoolkit, using

_connectionProperties = New Engine.ConnectionProperties(".\\SQLEXPRESS", "QCM.mdf")

_connectionProperties.IntegratedSecurity = True

m_db2.Register(_connectionProperties, default)


It tells me that I cant connect with the user name "[machinename]\\[windowsusername]"

where [machinename] is my pc name and [windowsusername] is who i'm logged in as.

It would be elpful to be able to pass a connectionstring in rather than the individual data....

any ideas..?
jprice2269
 
Posts: 7
Joined: Sun Dec 02, 2007 4:52 pm

Postby Brian Donahue » Tue Dec 04, 2007 11:26 am

ConnectionProperties accepts a server, database, and optionally a username and password. It does not support attaching an MDF file. Omitting the username and password will force integrated Windows authentication, but you cannot specify an account with Windows auth, and them's the rules.

As a workaround, you can try adding the attachdb parameter into the server name, which will effectively let you attach an MDF to the SQLEXPRESS instance so that you can compare to it. The method for formatting the server connection string is described here.
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am


Return to SQL Toolkit Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests