C# WPF SAMPLE Problem

Hello. I'm a Korean user using OCC. I've been using mfc so far and now I want to move on to c # (wpf). But when I run sample and continue to press new on wpf sample
System.IO.FileNotFoundException
  HResult = 0x8007007E
  Message = Cannot load file or assembly 'OCCTProxy.dll' or one of its dependent files or assemblies. The specified module could not be found.
  Source = IE_WPF_WinForms
  StackTrace:
   at IE_WPF_WinForms.OCCViewer..ctor () in D: \ opencascade-7.4 \ opencascade-7.4.0 \ samples \ CSharp \ WPF_WinForms \ OCCViewer.cs: line 108
   at IE_WPF_WinForms.MainWindow.NewCommand_Executed (Object sender, ExecutedRoutedEventArgs e) in D: \ opencascade-7.4 \ opencascade-7.4.0 \ samples \ CSharp \ WPF_WinForms \ MainWindow.xaml.cs: line 155
   at System.Windows.Input.CommandBinding.OnExecuted (Object sender, ExecutedRoutedEventArgs e)
   at System.Windows.Input.CommandManager.ExecuteCommandBinding (Object sender, ExecutedRoutedEventArgs, CommandBinding commandBinding)
   at System.Windows.Input.CommandManager.FindCommandBinding (CommandBindingCollection commandBindings, Object sender, RoutedEventArgs, ICommand command, Boolean execute)
   at System.Windows.Input.CommandManager.FindCommandBinding (Object sender, RoutedEventArgs, ICommand command, Boolean execute)
   at System.Windows.Input.CommandManager.OnExecuted (Object sender, ExecutedRoutedEventArgs e)
   at System.Windows.RoutedEventArgs.InvokeHandler (Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler (Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl (Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl (DependencyObject sender, RoutedEventArgs args)
   at System.Windows.Input.RoutedCommand.ExecuteImpl (Object parameter, IInputElement target, Boolean userInitiated)
   at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource (ICommandSource commandSource, Boolean userInitiated)
   at System.Windows.Controls.MenuItem.InvokeClickAfterRender (Object arg)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall (Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen (Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl ()
   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper (Object obj)
   at System.Threading.ExecutionContext.RunInternal (ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run (ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run (ExecutionContext executionContext, ContextCallback callback, Object state)
   at MS.Internal.CulturePreservingExecutionContext.Run (CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke ()
   at System.Windows.Threading.Dispatcher.ProcessQueue ()
   at System.Windows.Threading.Dispatcher.WndProcHook (IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean & handled)
   at MS.Win32.HwndWrapper.WndProc (IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean & handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation (Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall (Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen (Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl (DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc (IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage (MSG & msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl (DispatcherFrame frame)
   at System.Windows.Application.RunDispatcher (Object ignore)
   at System.Windows.Application.RunInternal (Window window)
   at IE_WPF_WinForms.App.Main ()

I get this error The occ dll is set as an environment variable. In addition, occtproxy builds successfully and shows the dll. And the occ project I've tested on my own has the same error. I haven't solved this error for a month and I just googled. How can I fix this error? What should I check? Please give me a solution.
Oh, I'm trying to use x64 for vs2019.

Kirill Gavrilov's picture

Have you already tried solutions for similar problem on this forum?
https://www.opencascade.com/content/reg-occtproydll-not-found

How exactly do you start the sample?

minkyu Kim's picture

Oh god..

I have the same symptoms Not one different. That forum article doesn't seem to be solved either. Please let me know how to solve this.. 

Kirill Gavrilov's picture

The referred topic specifies what should be checked first of - DLL dependences. This is the source of the problem in 99% cases.
Have you tried running the sample from a link in Start menu from pre-built OCCT installed in the system?

minkyu Kim's picture

Well. First I downloaded the tgz file from the homepage and used the project in csharp of samples in the folder. And the occ dll was made through cmake. I have confirmed that this is not a problem with the dll by building successfully on mfc. I've seen that the occtproxy dll is created properly in the exe folder that I want to run. And the moment the exe runs
 OCCViewer aForm = new OCCViewer (); The code is stopping at this line. I didn't run the project using a bat file. I manually registered the environment variable and ran it, and the mfc sample was run successfully this way.

Perhaps one of the current solutions is to run the occtproxy dll in the wpf project. 

for exmple, add other environment variables or project options in addition to the occ dll path. .

If you have a solution for this, please let me know. Thanks for the reply.