Problem upgrading from old SDK
conquistadorst
Posts: 10
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:
The error is:Dim mappings As New SchemaMappings()
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?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)
Comments
.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.
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
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