Search code examples
c#.netsql-serversql-server-data-toolsdacpac

DacFx: Error loading Microsoft.Data.Tools.Schema.Sql.resources


I am trying to use DacFx in my application. I have installed DacFx package from nuget with command:

Install-Package Microsoft.SqlServer.DacFx.x64

After that, I am following this guide:

http://blogs.msmvps.com/deborahk/deploying-a-dacpac-with-dacfx-api/

But, on the line

dacServiceInstance.Deploy 

I get System.IO.FileLoadException while trying to load "Microsoft.Data.Tools.Schema.Sql.resources, Version=13.0.0.0, Culture=ru-RU, PublicKeyToken=b03f5f7f11d50a3a"

Library is at the place, but for additional information I have this text (unlocalized by me) in FusionLog property of exception:

The located assembly's manifest definition does not match the assembly reference: CULTURE
Failed to complete setup of assembly (hr = 0x80131040)

As I can suppose, framework is trying to load this assembly, but somehow manifest culture differs from actual culture. What can I do with this?

Nuget package used: Microsoft.SqlServer.DacFx.x64 version 130.3485.1

Application is Windows desktop application with WPF, no MVC or other web stuff.

I am using MSVS 2013, Windows 7 Russian(I think, that it can be the part of the problem)

UPDATE: Workaround exists by changing local culture to "en-US". It seems that any method of changing it works, because Fusion (.Net assembly loader) then doesn't try to load resource assembly. Checked other cultures, like "pt-BR", all are broken with the same error as "ru-RU". I don't know, maybe it is a nuget package glitch. Now I have inserted

Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");

in my application and everything works. Please, post a comment, if there is more convenient way to workaround this without changing culture of the application.


Solution

  • Okay, I got it.

    MSVS 2013 - latest updates, latest SSDT - doesn't work with culture other than "en-US". Tried Nuget package from question, separate DacFx.msi from MS - NO EFFECT.

    MSVS 2015 - latest updates, latest SSDT - works perfectly with any culture.