Mon, 12/09/2024 - 19:44
Forums:
Hi, I've been trying to get the C# sample to work.
First, in a x64 solution, I got the C++ project to compile (C++ 20, added all the source code to an import folder, and the .lib to another) via Visual Studio 22.
Then, when I try to use the WinForms sample, as I click New a System.BadImageFormatException happens.
I tried to turn the compilation to x86 as suggested by the readme but it doesn't even compile and get a lot of LNK2001, LNK2019 and LNK 2028.
The configuration is the same as on the x64 solution.
Did I do something wrong while compiling the Proxy or is there something else I'm missing?
Here are some pics of the config of the proxy and the following execution error.
Attachments:
Mon, 12/09/2024 - 20:03
Hello. Do you use Open-Cascade-SAS/OCCT-samples-csharp: OCCT .NET Sample.? In that case you need to use OCCY 7.6
The latest version: OCCT/samples/CSharp at master · Open-Cascade-SAS/OCCT
Based on screen you are using old sample with latest OCCT or at least 7.8. Please check the latest sample version.
Additionally, C++17 is latest supported version by CLI/C++ (used to wrap C++ under C#).
Best regards, Dmitrii.
Tue, 12/10/2024 - 17:46
Hi,
I think I had the latest version of OCCT and sample, but went ahead and rebuilt it to be sure.
I changed C++ to 17, used the 7.8 OCCT libs (x64) and the CSharp sample you provided (latest version) but the same error keeps popping up. I haven't done anything with the third party libraries so maybe that's the problem? What should I do with them in case they are necessary for the CSharp sample?
Thanks and regards, Fran.
Tue, 12/10/2024 - 18:09
To correct loading the project you need to extend PATH variable to have all ".dll" of the 3rd-party reachable. In another cases you will have issue to load Proxy DLL.
It is complicated to analyze screenshots - better to share logs.
Best regards, Dmitrii.
Wed, 12/11/2024 - 03:01
You mean the Environment.GetEnvironmentVariable("CSF_OCCTDataPath") on the csharp project?