What are the challenges you face when working across database platforms? Take the survey

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

jr365jr365 Posts: 4 Bronze 1
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 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)
	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");
			//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
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()


-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!


  • Options
    jr365jr365 Posts: 4 Bronze 1
    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.
    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.
  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    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
  • Options
    jr365jr365 Posts: 4 Bronze 1
    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:

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

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


    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?
  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1

    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.
Sign In or Register to comment.