"Could not load file or assembly 'RedGate.SqlClone.Unmanaged.dll' or one of its dependencies" error
Published 08 February 2017
When the SQL Clone Agent installation fails, you might see an error among Windows Application Event Logs, which is similar to below one:
"Could not load file or assembly 'RedGate.SqlClone.Unmanaged.dll' or one of its dependencies" error
System.IO.FileNotFoundException: Could not load file or assembly 'RedGate.SqlClone.Unmanaged.dll' or one of its dependencies. The specified module could not be found. File name: 'RedGate.SqlClone.Unmanaged.dll' at RedGate.SqlClone.Agent.Service.SqlCloneSetup.InitializeAgent() at RedGate.SqlClone.Agent.Service.RegisteredAgentLifetime.CreateRegisteredAgentLifetime(AgentSettings settings, X509Certificate2 certificate, CancellationTokenSource cancellationTokenSource, ILogger logger, Boolean retryRegistration) at RedGate.SqlClone.Agent.Service.AgentServiceTask.<>c__DisplayClass8_0.<RegisterAndStartAsync>b__0() at System.Threading.Tasks.Task`1.InnerInvoke() at System.Threading.Tasks.Task.Execute() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at RedGate.SqlClone.Agent.Service....
This can happen when Microsoft Visual C++ 2017 Redistributable (x64) is not installed correctly on the machine. SQL Clone Agent installer currently tries to install this dependency if it's not already there. However, the installation is not performed correctly when you do not have KB2919355 installed. KB2919355 also requires KB2919442 installed prior to installing it. In order to fix this issue, you need to follow the below steps in given order:
- Download the appropriate version of KB2919442 depending on your Windows version and install it.
- Download the appropriate version of KB2919355 depending on your Windows version and install it.
- Restart Windows.
- Download Microsoft Visual C++ 2017 Redistributable (x64) and install it.
- Retry the installation of SQL Clone Agent.