Problem upgrading from old SDK

Automate and integrate using the SQL comparison API

Moderator: Chris Auckland

Problem upgrading from old SDK

Postby conquistadorst » Mon Jan 04, 2010 9:31 pm

I just upgraded my .net solution from an old version of the SDK, I believe v. 5, to the latest v. 8. Everything compiles fine but I'm getting a very strange exception that's only being thrown at runtime. I've narrowed it down to one line of code:
Dim mappings As New SchemaMappings()

The error is:
Could not load file or assembly 'RedGate.Shared.Utils, Version=7.1.0.39, Culture=neutral, PublicKeyToken=7f465a1c156d4d57' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

The latest version (I'm currently working with) is 7.3.0.25. Why is it looking for an older version? Were your SDK dlls compiled with a different version of RedGate.Shared.Utils than what was included? Any ideas?
conquistadorst
 
Posts: 7
Joined: Fri Aug 28, 2009 2:25 pm

Postby Brian Donahue » Wed Jan 06, 2010 2:35 pm

I don't think that Shared.Utils and Shared.Sql versions need to match the Engine versions, because these libraries are produced independently from the SQLCompare.Engine and SqlDataCompare.Engine.

.NET is going to look for these as dependencies, and it's going to use its' normal "probing" process, so I think that these two assemblies need to be in the same folder as the Engine assemblies. I'd make sure that all of the references are using the SDK installation path and not the SQL Compare/Data Compare program folders.
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am

Postby ryolatl@hotmail.com » Tue Aug 30, 2011 4:22 pm

I'm trying to make a test to evalute this tool, I just downloaded the trial version at the moment to run the program on VS I'm having this error

Could not load file or assembly 'RedGate.Shared.Utils, Version=7.1.0.39, Culture=neutral, PublicKeyToken=7f465a1c156d4d57' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I check all the dll's and they are in the folder, then I tried to change the dll version from 7.3.0.25 to 7.1.0.39 and I get an error that say something like this

you have 2 dll pointing one inderect, on direct, please change the indirect 7.1.0.29 to the direct 7.3.0.25. If I do this, I got the same error once again. could you point me in the right direction?

thanks
ryolatl@hotmail.com
 
Posts: 3
Joined: Tue Aug 30, 2011 4:12 pm

Postby Brian Donahue » Tue Aug 30, 2011 5:16 pm

You tried to redirect the assembly? I'm a bit confused about what you want to do -- surely you just need to copy the DLLs you need into the same folder where you reference RedGate.SQLCompare.Engine.dll? The DLL versions you need should all be in the right folder and the right versions.
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am

Postby ryolatl@hotmail.com » Tue Aug 30, 2011 6:27 pm

this is what I'm doing

when I use the dll RedGate.Shared.Util version 7.1.0.39 I got this error message.

The project currently contains references to more than one version of RedGate.Shared.Utils, a direct reference to version 7.1.0.39 and an indirect reference (through 'RedGate.SQLCompare.Engine.Database') to version 7.3.0.25. Change the direct reference to use version 7.3.0.25 (or higher) of RedGate.Shared.Utils.


if i Use the dll RedGate.Shared.Util version 7.3.0.25 I got this error

Could not load file or assembly 'RedGate.Shared.Utils, Version=7.1.0.39, Culture=neutral, PublicKeyToken=7f465a1c156d4d57' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)


I'm stock and I'm not sure where to move.. Below you can find the code that I'm using.
I'm trying to compare a Databases to then update the second one with the Data that is new in the first one.

Imports RedGate.SQLCompare.Engine
Imports RedGate.SQLDataCompare.Engine
Imports RedGate.SQLDataCompare.Engine.ResultsStore

Public Class Form1

Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click

Dim session As New ComparisonSession

'register the databases for comparison
Dim db1 As New Database
Dim db2 As New Database

db1.RegisterForDataCompare(New ConnectionProperties(\"10.1.202.111\", \"Sync_source\", \"user\", \"pass\"))
db2.RegisterForDataCompare(New ConnectionProperties(\"10.1.202.111\", \"Sync_target\", \"user\", \"pass\"))

Dim mappings As New TableMappings

Dim tableMapping As TableMapping = mappings.Join(db1.Tables(\"[dbo].[tbl_Persons]\"), db2.Tables(\"[dbo].[tbl_Persons]\"))

' Set the custom comparison key for the table
tableMapping.MatchingMappings.Clear()
tableMapping.MatchingMappings.Add(tableMapping.FieldMappings(\"PersonID\"))
tableMapping.RefreshMappingStatus()

' Set the where clause for the comparison
tableMapping.Where = New WhereClause(\"ChangeValue > 0\")

'compare the databases
session.CompareDatabases(db1, db2, mappings)

Dim mapping As TableMapping


Dim difference As TableDifference = session.TableDifferences(\"[dbo].[tbl_Persons]\")
Dim row As Row
For Each row In difference.ResultsStore 'loop through all the rows
Dim field As FieldPair
Dim i As Int32 = 0
'Console.WriteLine(\"Row {0} type {1}\", row.Index, row.Type.ToString())

'txtResults.Text =+ \"Row {0} type {1}\", row.Index, row.Type.ToString())
txtResults.Text += \"Row \" + row.Index.ToString + \" Type \" + row.Type.ToString()
For Each field In difference.ResultsStore.Fields
'work out where about in the results the field data is stored
'if we were comparing identical records, or records present in one
'database but not the other then we would not need to
'use the OrdinalInResults1 and OrdinalInResults2 properties
'but just OrdinalInResults
Dim field1 As Int32 = field.OrdinalInResults1
Dim field2 As Int32 = field.OrdinalInResults2

If (field1 <> field2) Then
'get the values
Dim value1 As Object = row.Values(field1)
Dim value2 As Object = row.Values(field2)
If (value1 Is Nothing) Then
value1 = \"NULL\"
End If
If (value2 Is Nothing) Then
value2 = \"NULL\"
End If
If row.FieldDifferent(i) Then
'Console.WriteLine(\"{0}:{1} <> {2}\", field.Field(False).Name, value1.ToString(), value2.ToString())
txtResults.Text += field.Field(False).Name + \":\" + value1.ToString() + \" <> \" + value2.ToString()
Else
' Console.WriteLine(\"{0}:{1} == {2}\", field.Field(False).Name, value1.ToString(), value2.ToString())
txtResults.Text += field.Field(False).Name + \":\" + value1.ToString() + \" = \" + value2.ToString()

End If
Else
'this is part of the unique index we are comparing on
Dim value As Object = row.Values(field1)
' Console.WriteLine(\"*{0}:{1}\", field.Field(False).Name, value.ToString())
txtResults.Text += \"*\" + field.Field(False).Name + \":\" + value.ToString()

End If
i += 1
Next
Next
'dispose of the objects
session.Dispose()
db1.Dispose()
db2.Dispose()


End Sub

End Class
ryolatl@hotmail.com
 
Posts: 3
Joined: Tue Aug 30, 2011 4:12 pm

Postby Brian Donahue » Wed Aug 31, 2011 9:25 am

If you are doing Data Comparisons you'll need to make sure all of the libraries come from the Data Compare Engine's folder. The ones in SQL Compare Engine are versioned differently, so if you try to mix and match you will have problems like this. The Data Compare library folder also has the SQL Compare Engine if you are comparing both schema and data.
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am


Return to SQL Comparison SDK Previous Versions

Who is online

Users browsing this forum: No registered users and 1 guest