Skip to main content
Home  ›  Blog

Scale * 5 with 2sxc HotBuild - On the 5th Day...

2sxc 17 introduces HotBuild, which will let you build 5x bigger Apps. Welcome to the 5th Day.

Important: This is still experimental.

In v17.00 we used the term ThisApp for the main folder and namespace. 

In v17.02 we're switching to AppCode. The Blog is updated to use that term. 

2sxc HotBuild WTF?

A limiting factor when creating large apps is managing and reusing lots of code. Previously it was possible to create helper CSharp files like FileHelper.cs, which would be accessed using CreateInstance(...). Typically you would then write things such as:

var fileHelper = CreateInstance("FileHelper.cs");
var size = fileHelper.GetSize("abc.jpg");

Despite being practical, it didn't scale well. Everything was dynamic and there was no type safety. And return values were also untyped, making it difficult to build sophisticated solutions. 

Our goal was to introduce the classic dev-experience where you would use var fileHelper = new FileHelper(); - just like in compiled DLLs. But way better - so it's compiled on the fly without restarting a server or anything. 

This is now possible! 💃 🎉

Thanks to the dedicated work of Tonci - who spent around 3 months in the depths of compilers, Roslyn, Assembly-Providers and really crazy 💩, we made magic happen.

How HotBuild works

  1. It all starts with a namespace AppCode and a folder AppCode
  2. Any .cs files placed in this folder will get compiled into a DLL on the fly - and served steaming hot directly to your Razor and other .cs files outside of this folder.
  3. So any other file which has a using AppCode will automatically get that DLL with all the classes, types and everything coded there.

HotBuild is Steaming Hot

Basically this allows you to have live (hot) compiled, shared DLLs in an App. But there's more:

  1. Each App is isolated in it's own Hot Tub - so the code will only be available and work inside that App.
  2. This allows you to have many sites with the same app (eg. the Blog) with different modifications as needed, and the DLLs will be different for each App!
  3. The moment you change a file in AppCode, the DLL will get recompiled on the fly, and previously compiled Razor files will get flushed from the cache, so that they can pick up any changes made. 

AND it works in ☢️ Dnn (.net Framework 4.7+) and 🩸 Oqtane (.net Core 8)! 

Scale Up like Crazy 🚀

This will allow you to create type-safe applications which are easily 10x more sophisticated than before (we just write 5* because it's the fifth day of Christmas 😉). Because:

  1. You can split your code into as many files as you like (eg. place some classes with properties in one file, helper code in others...)
  2. VS Code can give you intellisense when you work with objects in other files (also new in v17)
  3. Return values can be typed using complex objects or tuples, and both VS Code and the compiler know this. 

This allows you to create way more complex solutions than ever before. On the fly. Without restarting DNN / Oqtane at every step. 

HotBuild will get even Better

This is just the beginning. In the coming months we'll gather some experience, monitor memory usage and performance and do various improvements.

It's important to note that this feature is still not perfect. When bugs prevent your code from compiling, the errors are still very cryptic and the line numbers don't seem to match the source. But we'll get that improved in January. 

After that we'll go the next steps:

  1. Add Polymorphism to allow open-heart surgery. This lets you develop enhancements on a production system, without affecting the users.
  2. Hot-Compile content-types based on the data, so that you can then work with typed BlogPost or RealEstate objects in your code.
  3. ...and we have some more ideas 😉 

Imagine What You Can Build 💡

Did you know that our company name 2SIC stands for 2serve, 2inspire, 2create? With this, we really hope 2serve you even more, 2inspire you 2create amazing things.

We hope that you're mind is already racing with ideas what you can build with this new technology.

Love from Switzerland and Croatia
iJungleboy & Tonci

Special Thanks to Tonci of Sistemi

A BIIIIIIG shoutout to Tonci 🙏 - he spent hundreds of hours figuring out how Roslyn works internally to make it work in both Dnn and Oqtane. What he did is really magic at the highest levels. 


Daniel Mettler grew up in the jungles of Indonesia and is founder and CEO of 2sic internet solutions in Switzerland and Liechtenstein, an 20-head web specialist with over 800 DNN projects since 1999. He is also chief architect of 2sxc (see github), an open source module for creating attractive content and DNN Apps.

Read more posts by Daniel Mettler