Can't open a .sdc Project modified by Sql Data Compare 8

Automate and integrate using the SQL comparison API

Moderator: Chris Auckland

Can't open a .sdc Project modified by Sql Data Compare 8

Postby jr365 » Sat May 29, 2010 7:21 am

This is a real big problem for me. :(

I have a solution where I update the data for my customer on one of their remote databases.

I have a lot of custom table mappings that I've created in the SQL Data Compare application. I was able to successfully use a project file to load custom mappings in version 7 of the api.

However, with version 8 of the api, it seems that I can't load any project that was saved by the current version of sql red gate compare. I am using 8.1.0.4 of Data Compare.

I don't need to include my own code, because your sample code breaks easily enough without anything custom.

Steps to reproduce:

-Open the Solution
-Modify the ProjectExample.cs file like this (we just take out the 'auto-create' logic that generates a blank project every time)
Code: Select all
   public class ProjectExample
   {
        private const string projectName = @"testproject2.sdc";
      
        public void RunExample()
      {
            if (!File.Exists(projectName))
            {
                Project project = new Project();

                project.DataSource1.DatabaseName = Program.DevDatabaseName;
                project.DataSource2.DatabaseName = Program.LiveDatabaseName;
                project.SessionSettings = SessionSettings.Default;
                project.Options = new EngineDataCompareOptions(MappingOptions.Default, ComparisonOptions.Default, SqlOptions.Default);
                Console.WriteLine("Saving project");
                project.SaveToDisk(projectName);
            }
         //load up the project
         Project project2 = Project.LoadFromDisk(projectName);

-find the 'testproject.sdc' file in the sample, and open it in Red Gate Data Compare.
-without changing anything, save as 'testproject2.sdc'
-run sample, and choose option 4 for the project mode.


You will get this exception:

RedGate.Shared.Utils.IO.Serialization.SerializationInvalidFileTypeException was unhandled
Message=Invalid file testproject2.sdc
Source=RedGate.Shared.Utils
FileName=testproject2.sdc
TypeName=SQLDataCompareProject
StackTrace:
at RedGate.Shared.Utils.IO.Serialization.XMLSerializeFormatter.a(XmlReader , String , String )
at RedGate.Shared.Utils.IO.Serialization.XMLSerializeFormatter.DeserializeRootObject(String fileName, String name, String typeName)
at RedGate.SQLDataCompare.Engine.Project.LoadFromDisk(String fileName)
at SQLDataCompareCodeSnippets.ProjectExample.RunExample() in C:\\Program Files\\Red Gate\\SQL Comparison SDK 8\\Samples\\Automating SQL Data Compare\\C#\\ProjectExample.cs:line 29
at SQLDataCompareCodeSnippets.Program.Main() in C:\\Program Files\\Red Gate\\SQL Comparison SDK 8\\Samples\\Automating SQL Data Compare\\C#\\Program.cs:line 63
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:




Questions:

-Is this by design?
-Did you drop this feature?
-How would you recommend I migrate all these custom mappings to a functional state?

Hopefully there is a quick fix!
jr365
 
Posts: 3
Joined: Sat May 29, 2010 7:04 am

Command line may be the solution

Postby jr365 » Sat May 29, 2010 8:43 pm

It looks like using the command line version of Sql Data Compare may be the solution.

I can pass in a version 8 project file, and the synchronization works.

Code: Select all
sqldatacompare.exe /pr SF-Sync2.sdc /sf output.sql


So, is it likely an issue with the sdk then? The downside is that I have to execute batch files instead of managed code, but a working solution is the goal for now.
jr365
 
Posts: 3
Joined: Sat May 29, 2010 7:04 am

Postby Brian Donahue » Mon May 31, 2010 12:32 pm

Hi Jeremiah,

Can you please try the latest cumulative patch to SQL Comparison SDK?
ftp://support.red-gate.com/patches/SQL_ ... _patch.zip

The only valid explanation is that there was a file format change to the SDC files that was not implemented in the SDK. The latest SDK should sort that out, if that's the case.

Also, don't forget to run ReplayUserActions to get your mappings from the project file. This was moved in SDK v8:
http://labs.red-gate.com/index.php/SQL_ ... re_project
Brian Donahue
 
Posts: 6669
Joined: Mon Aug 23, 2004 10:48 am

Version numbers

Postby jr365 » Mon May 31, 2010 8:54 pm

Hi Brian,

Before trying the patch, I attempted this, and it worked perfetctly:

The problem is that the dlls inside the sdk folder are from product version 7:
Image

And the dlls inside the DataCompare application folder are the current version:
Image

So I just used the dlls from the application directory instead of the sdk directly. Everything seems to work properly

Question:

Can I still deploy my solution to another machine? Will that work? Or do I need to use those special sdk assemblies?

I am not sure why the sdk assemblies are from another version, am I missing something?
jr365
 
Posts: 3
Joined: Sat May 29, 2010 7:04 am

Postby Brian Donahue » Tue Jun 01, 2010 9:41 am

Hello,

The problem is that the SQL Comparison SDK, as a product, is not updated at the same time as the commercial versions of the products. The "official" release of SDK still contains SQL Compare Engine 8 and SQL Data Compare Engine 7, which is why I had suggested the cumulative patch.

But you can use the dlls from the SQL Data Compare product and they will work in exactly the same way as if they came from the SDK, so if you have got everything set up to use the dlls from Data Compare, you can continue working with them.
Brian Donahue
 
Posts: 6669
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 0 guests