0

I'm running a .NET application inside a Windows-based Docker container. The app uses OCCT.NET, and all the required OCCT native DLLs and OCCT .NET DLLs are present inside the image, under the app's bin/Debug/net9.0 folder.

The app runs fine when executed from an IDE like Visual Studio Code, but when trying to make a Windows-based Docker image the runtime throws error "Could not load file or assembly 'C:\app\Occt.NET.dll'. The specified module could not be found."

I have tried the DOCKER EXEC command to verify that the files are indeed in the specified directory, and I also installed the X64 VC_REDIST.EXE in the image.

I also tried with Linux-based Docker images before switching to Windows-based, as I thought maybe the code was incompatible with Linux.

Now I think the issue is likely related to manually placing the external OCCT files and libraries in the bin folder. Normal .NET app Docker images are running fine, but I have a similar problem with my other .NET app that also depends on external libraries.

DavidMWilliams
8682 gold badges14 silver badges25 bronze badges
asked May 12, 2025 at 15:21
5
  • How does your app reference the .dll? Commented May 12, 2025 at 20:11
  • I have added the Occt.NET package via the "dotnet add package Occt.NET --version 7.9.0" command. But it doesn't automatically brings the dlls in bin folder during build of my app. So, I have put Occt.NET.dll and its relative dlls inside libs folder and mention csproj file of my app to manually copy every dll inside bin folder during build time. Below is snippet form my csproj <ItemGroup> <Reference Include="Occt.NET"> <HintPath>libs\Occt.NET.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> <PackageReference Include="Occt.NET" Version="7.8.1.2" /> </ItemGroup> Commented May 22, 2025 at 4:50
  • This is working when running from an IDE like VS Code, but I'm not able to run the app in Docker whether Windows based image or Linux. I tried manually copying the dlls inside output directory of docker image but still not working. Commented May 22, 2025 at 4:52
  • It looks like you are mixing two types of referencing the same library. Have you tried just using nuget package reference? Commented May 26, 2025 at 12:01
  • Also it would be good to share the relevant dockerfile for your image. Commented May 26, 2025 at 12:02

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.