Options

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

jprice2269jprice2269 Posts: 9
edited December 4, 2007 5:26AM in SQL Toolkit Previous Versions
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

Comments

  • Options
    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
  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    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?
  • Options
    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
  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    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.
  • Options
    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..?
  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    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.
Sign In or Register to comment.