## Building log4net

Log4net provides support for the following targets
- net462
- netstandard2.0

TL;DR (Windows):
- install Visual Studio Build Tools (at least VS2019)
- install the .NET SDK (v10 or better - the sources use C# 14 language features)
- in the project folder:
  - `dotnet build src/log4net.sln`
  - `dotnet test src/log4net.sln`

TL;DR (Docker):
- install docker (if you haven't already)
  - https://docs.docker.com/engine/install/
- in logging/log4net run
  - `docker build -t log4net-builder .`
  - `docker run -it log4net-builder`
    - this will
      - install all dependencies in the container
      - build src/log4net.sln
  - inside the container run
    - `dotnet test /logging-log4net/src/log4net.sln`

TL;DR (!Windows):
- install the dotnet SDK - v10 or better (the sources use C# 14 language features)
- in the project folder:
  - `dotnet build src/log4net.sln`
  - `dotnet test src/log4net.sln`
- Mono is *not* required. The `net462` / `net472` targets are compiled against the
  `Microsoft.NETFramework.ReferenceAssemblies` packages that the .NET SDK references
  implicitly. Mono would only be needed to *execute* net4x assemblies.
- the `log4net.Tests` project skips `net462` on non-Windows platforms: VSTest hosts net4x tests
  through `TestHostNetFramework/testhost.exe`, which needs a .NET Framework runtime - Mono, off
  Windows. The Ubuntu 24.04 and macOS 26 runner images no longer ship Mono, so the run would
  abort with `TESTRUNABORT`. The `net462` tests run only on the Windows job in CI.

## The full story

Options:
- build locally. Suggested environment:
    - Pre-requisites:
        - the .NET SDK, at least v10 (the sources use C# 14 language features)
        - on Windows: Visual Studio 2019 Build Tools or later, including desktop targets
          - only Windows can *run* the `net462` tests; elsewhere that target is skipped
    - Binaries can be built with a Visual Studio or Rider installation
    - Binaries, packages and a release zip can be built via commandline
        - `dotnet build src/log4net.sln`
        - optionally `dotnet test src/log4net.sln` to run all tests
        - release artifacts are generated by the scripts under `scripts/`:
            - `scripts/build-preview.ps1` for a preview package
            - `scripts/build-release.ps1` for a full release
- build via docker, see the Docker section above

## Updating the site

Log4Net uses Maven to build the site. Source artifacts can be found under `src/site`.
Building the site can be accomplished with `./mvnw site` (`.\mvnw.cmd site` on Windows) - the
committed Maven wrapper fetches the pinned Maven version, so only a JDK is required. This is
also what `scripts/build-release.ps1` uses. The `antora` profile inherited from `logging-parent`
activates automatically because `src/site/antora` exists; it installs Antora and runs it against
`antora-playbook.yaml`, so no separate npm step is needed.

The site will be generated in `target/site`, and can be viewed locally. Updates should
be pushed to the `asf-staging` branch of [https://github.com/apache/logging-log4net-site](https://github.com/apache/logging-log4net-site])

Once the site has been pushed to the `asf-staging` branch, it can be viewed at
[http://logging.staged.apache.org/log4net](http://logging.staged.apache.org/log4net)
