C# toolchain under Linux

Dear all,

in my spare time I am trying to learn how to generate custom functionality with Bricscad v22 under Linux using C#, since I see myself incapable of learning Brx syntax. My developing background is irregular so the question might be to nooby for some to answer. As I keep telling my children, that there are no stupid questions, so I pose mine as follows.

1#On Ubuntu the Bricscad installation resides under /opt/bricsys/bricscad/v22
2#SDK has been uncompressed to /opt/bricsys/BRXSDK_Bcad_V22_1_04
3#.profile has been extended with

export BRX22_SDK_PATH="/opt/bricsys/BRXSDK_Bcad_V22_1_04"
export BRX_PATH="/opt/bricsys/BRXSDK_Bcad_V22_1_04"

4#Compiler is installed via apt-get install dotnet-sdk-5.0
5#Trying to compile samples/CsBrxMgdCivil with dotnet msbuild /t:Build /p:Configuration=Release does not work out of the box
6#A fresh project is set up using dotnet new console --framework net5.0
7#It compiles smoothly using dotnet msbuild /t:Build /p:Configuration=Release
8#The sample from 5# contains reference includes for BrxMgd and TD_Mgd, which I am unable to resemble in the csproj file. I undergo the assumption that the dynamic library should reside in 1#, but I cannot find it. Variations of below syntax do not work.

    <Reference Include="BrxMgd">

Any hints are appreciated, even if it's the that C# + Bricscad + Linux might not be possible.

Best regards



  • "With BricsCAD V21, the supported .NET framework version is 4.5.1 (CLR version 4)"
    It is a Windows only - .NET Core and now .NET 5 are multiplatform.

  • @cadmaster

    I am able to do

    using System;
    using System.Text;
    using System.Runtime.InteropServices;
    namespace CS
        class Program
            [DllImport("libbrx22.so", CharSet = CharSet.Auto,
                CallingConvention = CallingConvention.Cdecl)]
            internal static extern int acedGetEnv(string envName, StringBuilder ReturnValue);
            public static string GetEnv(string envName)
                StringBuilder buf = new StringBuilder(2048);
                acedGetEnv(envName, buf);
                return buf.ToString();
            static void Main(string[] args)
                Console.WriteLine("Hello World!");

    Since the compiler does not throw an error I presume that libbrx22.so is found. When I then publish

    dotnet publish --configuration Release --framework net5.0


    dotnet publish --self-contained -r linux-x64 --no-dependencies

    and try to load the resulting output I receive the error

    Loading /home/sebastian/Dokumente/BricsCAD/CS/bin/Debug/net5.0/linux-x64/CS.dll
    Error loading "/home/sebastian/Dokumente/BricsCAD/CS/bin/Debug/net5.0/linux-x64/CS.dll": 
    /home/sebastian/Dokumente/BricsCAD/CS/bin/Debug/net5.0/linux-x64/libCS.so: cannot open shared object file: No such file or directory.
    /home/sebastian/Dokumente/BricsCAD/CS/bin/Debug/net5.0/linux-x64/CS.dll loading failed.

    So in my understanding I conclude, that it seems possible to import functionality from a shared object library from the install, but that either the compilation path is wrong, or that loading of dotnet libraries does not work. I am grateful for further comments.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!