clr

dangercoder 2026-04-20T17:00:59.509299Z

I'm about to bump this tool to the latest clojure-clr version but it allows anyone to just use clojure-clr together with a .csproj project and dotnet run , dotnet test , dotnet build , dotnet publish works. (early days, here be dragons, but works for my projects) https://github.com/Dangercoder/Clojure.MSBuild/tree/master/examples/minimal-api I found this part interesting, where you can freely just mix C# and cljr https://github.com/Dangercoder/Clojure.MSBuild/tree/master/examples/csharp-interop/src and it just works seamlessly.

❤️ 2
amar 2026-04-25T01:01:53.133729Z

@jarvinenemil Thanks for this library. I was able to get things to work in my toy project as I try to learn .NET. Could you help me understand how MSBuild knows to call Clojure.MSBuild to generate the ClojureEntry.g.cs file? Also ClojureEntry.g.cs is treated as a script with an implicit Main method and so no StartupObject tag is required in the .csproj file I guess?

dangercoder 2026-04-20T17:03:37.452439Z

The .csproj is very small

amar 2026-04-20T01:44:03.982329Z

Hi. I'm a noob to ClojureCLR and .NET. I have a toy project at https://github.com/xfthhxk/try-clojure-clr and I can run the code with bb run:main. I have been stuck on a couple of things. 1. How to AOT properly? When I run compile, the DLLs are placed in the project root instead of *compile-path* which is bound to "classes". 2. Also how do I make DLLs/executables that will run on Linux and Windows? Would appreciate any help with this. Also is there a ClojureCLR guide for JVM Clojure people?

dmiller 2026-04-21T15:11:54.061339Z

I just pushed alpha7.

dmiller 2026-04-21T15:12:34.917999Z

Let me know if it solves the *compile-path* problem for you.

amar 2026-04-21T15:21:04.813459Z

super! I'll try it out later today. thank-you!

amar 2026-04-22T01:13:35.063499Z

Yes the compilation output is now going to the *compile-path* directory. Thanks @dmiller

amar 2026-04-22T02:00:43.993919Z

Although now I'm not sure how to run the output. Seeing this

dotnet ./assemblies/foo.core.cljr.dll
You must install or update .NET to run this application.

App: /home/user/projects/xfthhxk/try-clojure-clr/assemblies/foo.core.cljr.dll
Architecture: x64
Framework: '', version '11.0.0' (x64)
.NET location: /nix/store/31bcbr9x95rxrjyzm4k4w152hnjfvbgf-dotnet-sdk-11.0.100-preview.2.26159.112/share/dotnet/

The following frameworks were found:
  11.0.0-preview.2.26159.112 at [/nix/store/31bcbr9x95rxrjyzm4k4w152hnjfvbgf-dotnet-sdk-11.0.100-preview.2.26159.112/share/dotnet/shared/Microsoft.NETCore.App]

Learn more:


To install missing framework, download:
My runtime config
cat assemblies/foo.core.cljr.runtimeconfig.json
{
  "runtimeOptions": {
    "frameworks": [
      {
        "name": "",
        "version": "11.0.0"
      }
    ],
    "rollForward": "LatestMajor"
  }
}
Same thing if I target assemblies/foo.core.exe

amar 2026-04-22T02:39:42.115099Z

ok finally got things to work! documented on the readme https://github.com/xfthhxk/try-clojure-clr

dmiller 2026-04-22T02:40:16.714719Z

The DLLs created by AOT compilation are not standalone executables. They must be loaded into a running ClojureCLR. If they are on the CLOJURE_LOAD_PATH, they can be discovered by require It is possible to create an actual executable using gen-class with`main` .

amar 2026-04-22T02:45:08.824059Z

major source of my troubles were getting the preview framework to be picked up along with the dearth of knowledge of framework/runtime. Good to know about the load path. Thanks very much for your help!

amar 2026-04-22T02:48:12.428259Z

It is super fun to use Clojure on .NET. I feel right at home in the REPL. Thank you!

dmiller 2026-04-22T04:12:37.347609Z

If you are into IDEs, NREPL is available, allowing you to plug into VSCode via Calva. (This probably should be written up also.)

👍 1
dmiller 2026-04-20T15:57:16.378809Z

This is a bug regarding *compile-path* introduced when AOT-compilation was re-established with .NET 9.0. I'll get a fix out (new alpha) by tomorrow. You are correct that AOT-compiled code is bytecode and will work on any platform running dotnet. There is no guide to ClojureCLR for ClojureJVM people. Attempt at humor: Do so few ClojureJVM people try ClojurCLR because there is not guide, or is there no guide because so few try? More seriously, if you would care to share what you would find / would have found useful, I'd love to know. Feel free to DM if you are so inclined.

amar 2026-04-20T16:09:22.553869Z

Thanks @dmiller ! I'll be happy to put together what I learn into some sort of documentation. I have mostly worked in JVM shops so never dabbled with ClojureCLR though I was aware it's an option if I ever had to do anything .NET related. It looks like work is going to give me the opportunity. Will need to provide some Blazor components to another team to embed in a Blazor based app. Lots to learn in the new ecosystem especially the dotnet tool and understanding .csproj files. One big gotcha that had me stuck for hours was that if something is built against an older SDK, it won't automatically work with a new SDK unless if the env variable DOTNET_ROLL_FORWARD=LatestMajor is set.

dmiller 2026-04-20T17:36:40.902119Z

I've never had to use that env var. Happy to talk Blazor anytime. I've spent a lot of time building prototypes in Blazor over the last year (but not using Clojure due to constraints, but happy to contemplate it). You might also be interested in the work by @jarvinenemil on integrating ClojureCLR into MSBuild builds. https://github.com/Dangercoder/Clojure.MSBuild .

amar 2026-04-20T18:16:02.727669Z

awesome. thank-you for the link and I may take you up on Blazor

amar 2026-04-20T01:57:14.065349Z

I guess the DLLs are bytecode so should work as long as the dotnet runtime is present?

amar 2026-04-22T18:38:33.082999Z

Yup I've been using nrepl from spacemacs flavored emacs. It's working well.

👍 1