BitmapVideoSource: Could not open file "CoreToolkits.dll" (SDK 2021 R2)

BitmapVideoSource videoSource ;
if(selectedCameraItem != null)
{
   videoSource = new BitmapVideoSource(selectedCameraItem);
   videoSource.Width = 1920;
   videoSource.Height = 1080;
   videoSource.SetWidthHeight();
   videoSource.SetKeepAspectRatio(true, true);
   videoSource.Init(1920, 1080, BitmapFormat.BGR24);
}

I am creating a component plugin to Milestone and need to use BitmapVideoSource class. After first call to Init() function I get the error, “Could not open file CoreToolkits.dll”. I tried the possible solutions shared in the this post (using dependencyWalker and adding every dll to my solution folder) but problem still persists. I do not know if this is a path/dependency problem or am I doing something wrong? Path of the MIPI SDK dll folder is also in the Environment Variables so I am stuck. Are there any other possible solutions I can try?

Please verify that you build x64.

You might want to test if MediaRGBVideoEnhancementPlayback sample works for you because the sample use the same BitmapVideoSource class.

https://doc.developer.milestonesys.com/html/index.html?base=samples/componentsamples/mediargbvideoenhancementplayback/readme.html&tree=tree_search.html?search=mediargbvideoenhancementplayback

Thank you for your response, yes my build is indeed x64. I tried the MediaRGBVideoEnhancementPlayback sample and I got the exact same error as well. I also tried to create BitmapVideoSource instance in another sample projects and got the same error. For some reason CoreToolkits.dll cannot be opened from any of the MIP samples.

The only other reason came to my mind is that I am using Visual Studio 2015 and not sure if it is supported with MIP SDK 2021 R2 . However I can run other sample projects and use MIP dll’s without any problem in my other applications (using VS 2015). Problem only occurs when I try to create BitmapVideoSource instance. I would appriciate any help I can get.

If anyone encounters this issue in the future, I finally solved this problem by copying CoreToolkits.dll into \bin\x64\Debug folder. For some reason Visual Studio could not find/open dependent dll’s if they are not copied into its bin folder(s) even though path of Milestone SDK path (…\Milestone\MIPSDK\Bin) was added to reference paths and environment variable path (I also checked the access permissions and started VS in administrator mode). I also needed to change the Copy Local property of all referenced dll’s to True so they are also copied to the same (\bin\x64\Debug) folder.

This is an expected behavior; you will need to put the dependent dlls in the expected location. The MIP SDK includes batch files for copying (CopyXxx.bat) please see this article -

https://doc.developer.milestonesys.com/html/index.html?base=reference/architecture/net_library_initialization.html&tree=tree_2.html

Please note that Milestone now recommend using the NuGet packages, if doing so all dlls will automatically be copied to the output folder.