Got an error about 'VideoOS.Toolkit.dll' dependencies when I executed the component we built.

I have to integrate our component based on MIP SDK and build an installer for our customer. When I use the .msi file to install on target machine. It will show the message:

Could not load file or assembly ‘VideoOS.Toolkit.dll’ or one of its dependencies. The specified module could not be found. Unhandled exception: VideoOS.Platform.MIPException: VideoOS.Platform.SDK.Export.Environment.Initialize() not called.

Current SDK version: 2022 R3 22.3.23.2

Milestone XProtect version on build machine: 2022 R3 22.3a internal version: 37

Windows version on build machine: windows 10 pro 21H2 19044.2130

Milestone XProtect version on target machine: 2020 R1a

Windows version on target machine: Windows Server 2012 R2 Standard

The target machine has been installed prerequisites:

  1. Microsoft Visual C++ 2015-2022 Redistributable (x86) - 14.32.31332
  2. Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.32.31332
  3. .Net Framework 4.7.2

Use MDpends.exe to load ‘VideoOS.Toolkit.dll’ in the installation folder. Platform miss-match dependencies are as below:

How could I fix the problem to make the component work?

When you have built the standalone component, it is important that all the files are included.

If you simply deploy the build target folder and all content, do you see the same error? If that works, I must suspect something is wrong with your installer.

I’ve added all miss-match dlls. Re-built, re-installed and executed it.

Got the following message:

Unhandled exception: VideoOS.Toolkit.FileException: Could not open file ‘CoreToolkits.dll’!

From VideoOS.Toolkit.ToolkitFactory.CreateInstance(String configurationXml)

From VideoOS.Platform.Common.InternalCommandServiceCommon.CreateAndRegisterToolkit[T](String configXml)

From VideoOS.Platform.SDK.Export.SDKInternalCommandService.ImageExporterConnect(FQID deviceFQID, Int32 width, Int32 height, Boolean keepAspectRatio, Boolean fillSpace, Boolean allowUspcaling)

From VideoOS.Platform.Data.JPEGVideoSourceImplementer.<>c__DisplayClass2_0.b__0()

From VideoOS.Platform.Data.GenericVideoSource`1.InitInternal(Func`1 imageExporterConnect, Action onConnected)

I found those type I added would be ‘file’ not ‘assembly’. Is that the problem?

When I install it with the same setup installer file on target machine (Windows server 2012 R2). It shows another error in execution:

Cannot start program. A required component is missing: api-ms-win-core-heap-l1-2-0.dll. Please install program again.

It is still unclear to us: If you simply deploy (copy) the build target folder and all content, do you see the same error?

Do you see this issue everywhere or do you have this one customer where there is an issue? Do you see it in your test setup you use when developing?

Sure. I got the same error even I copied the build target folder include all contents to target machine(even the same windows version). The only workable way is run the application in Visual Studio IDE. But this way is too bad. We supposed not to expose our source code to customer and I think they also won’t like to run it with IDE. I’d like to provide more information if you need.

I know there are a little bit different between Windows 10 and Windows Server. I’ve solve the dependencies problem as below.

However, it still shows unhandled exception regarding System.BadImageFormatException. it cannot load the VideoOS.Platform.SDK.Export. Finally, the application will be terminated. Do I miss something?

System.BadImageFormatException means that 32bit and 64 bit is being mixed.

I have a nagging feeling you must have a wrong dll in the mix. Please make sure you empty the target folder and then build again using the NuGet. (Don’t copy any files just the NuGet building.)

You see the issue deploying on a Windows Server 2012 R2 Standard, do you see the same issue deploying on a Windows 10?

If you in the development machine exit the Visual Studio IDE and then execute the program, do you see the error even then?

I’ve tried to copy \bin\x64 to another machine with Windows 10 and it worked. Nevertheless, Windows server still didn’t work.

├── bin

│ ├── Debug. => [x] Windows 10, [x] Windows Server

│ ├── Release

│ └── x64 => [O] Windows 10, [X] Windows Server

└── obj

├── Debug

├── x64

I’d like to build a setup file instead of coping all contents to make they run the .exe manually.

Moreover, target machine is Windows 10. Shall I build my project on Windows Server?

We think we have an idea what the issue is.

XProtect 2020 R1 is supported on Windows Server 2012 R2 Standard

XProtect 2022 R3 is not supported on Windows Server 2012 R2 Standard

MIP SDK 2022 R3 shares a lot of the core technology with the XProtect of same version, and we think this is breaking the functionality here.

The newest version of XProtect that support Windows Server 2012 R2 Standard is XProtect 2022R2.

If you build using MIP SDK 2022 R2 it should be able to work on Windows Server 2012 R2 Standard.

See system requirements and supported OS for XProtect here: https://www.milestonesys.com/support/tools-and-references/system-requirements/

Thanks for your help. I found the latest version will invoke the windows update when login the milestone management server. Due to no internet, the program throws the exception of server not found after the timeout of windows update occurs. I’ve downgrade my SDK version to 22.1.0, and the problem has gone.

One more question. How could I package all debug folder as an installer. I used to make the installer with the extension of Microsoft Visual Studio Installer Projects. However, it doesn’t work cause the dependencies. Is there a better way to do so?

If you copy the target / output folder when you build the MIP SDK based stand-alone application, this should be the perfect way to deploy. This would be the case except if the MIP SDK doesn’t support the OS on which the application is copied / deployed (as we found to be the issue here).

Unfortunately we have no experts in Milestone Support on whether (or how) this can be achieved using Microsoft Visual Studio Installer Projects or other installer frameworks, this falls a little outside our area of expertise.

I am hoping other developers following this forum might know and offer ideas.