Runtime considerations

Runtime setup

Bazel rules maintain the list of files required to run given executable. When the run is requested (via bazel run or bazel test) then a manifest file is generated by Bazel.

It was tried to use the manifest to symbolically link appropriate dependencies, but it hasn't worked. .NET Core didn't work with dependencies dynamically linked.

Therefore, an alternative approach is used. The dependencies are copied side-by-side to the target assembly.

Bazel works best in the monorepo scenario where all dependencies are built by it using the same .NET Core runtime version. An attempt to build some common open source libraries is maintained here.

However, many .NET Core projects are composed of multiple dependencies gathered via Nuget. Those dependencies are often built using different versions of .NET Core. Typically, msbuild-based build systems handle it automatically by providing appropriate deps.json and runtimeconfig.json files. See this article for a very interesting overview.

Unfortunately, Bazel dotnet rules currently are not able to generate these files. Therefore, if multiple versions of .NET Core are mixed then a user has to provide them manually.